mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-26 03:11:08 +00:00
Add saved_only post_view test.
This commit is contained in:
parent
5ee689397d
commit
67f4d1c773
1 changed files with 42 additions and 2 deletions
|
@ -765,10 +765,20 @@ mod tests {
|
||||||
local_user_vote_display_mode::LocalUserVoteDisplayMode,
|
local_user_vote_display_mode::LocalUserVoteDisplayMode,
|
||||||
person::{Person, PersonInsertForm},
|
person::{Person, PersonInsertForm},
|
||||||
person_block::{PersonBlock, PersonBlockForm},
|
person_block::{PersonBlock, PersonBlockForm},
|
||||||
post::{Post, PostHide, PostInsertForm, PostLike, PostLikeForm, PostRead, PostUpdateForm},
|
post::{
|
||||||
|
Post,
|
||||||
|
PostHide,
|
||||||
|
PostInsertForm,
|
||||||
|
PostLike,
|
||||||
|
PostLikeForm,
|
||||||
|
PostRead,
|
||||||
|
PostSaved,
|
||||||
|
PostSavedForm,
|
||||||
|
PostUpdateForm,
|
||||||
|
},
|
||||||
site::Site,
|
site::Site,
|
||||||
},
|
},
|
||||||
traits::{Bannable, Blockable, Crud, Joinable, Likeable},
|
traits::{Bannable, Blockable, Crud, Joinable, Likeable, Saveable},
|
||||||
utils::{build_db_pool, build_db_pool_for_tests, DbPool, RANK_DEFAULT},
|
utils::{build_db_pool, build_db_pool_for_tests, DbPool, RANK_DEFAULT},
|
||||||
CommunityVisibility,
|
CommunityVisibility,
|
||||||
PostSortType,
|
PostSortType,
|
||||||
|
@ -1219,6 +1229,36 @@ mod tests {
|
||||||
cleanup(data, pool).await
|
cleanup(data, pool).await
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
#[serial]
|
||||||
|
async fn post_listing_saved_only() -> LemmyResult<()> {
|
||||||
|
let pool = &build_db_pool().await?;
|
||||||
|
let pool = &mut pool.into();
|
||||||
|
let data = init_data(pool).await?;
|
||||||
|
|
||||||
|
// Save only the bot post
|
||||||
|
// The saved_only should only show the bot post
|
||||||
|
let post_save_form = PostSavedForm {
|
||||||
|
post_id: data.inserted_bot_post.id,
|
||||||
|
person_id: data.local_user_view.person.id,
|
||||||
|
};
|
||||||
|
PostSaved::save(pool, &post_save_form).await?;
|
||||||
|
|
||||||
|
// Read the saved only
|
||||||
|
let read_saved_post_listing = PostQuery {
|
||||||
|
community_id: Some(data.inserted_community.id),
|
||||||
|
saved_only: Some(true),
|
||||||
|
..data.default_post_query()
|
||||||
|
}
|
||||||
|
.list(&data.site, pool)
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
// This should only include the bot post, not the one you created
|
||||||
|
assert_eq!(vec![POST_BY_BOT], names(&read_saved_post_listing));
|
||||||
|
|
||||||
|
cleanup(data, pool).await
|
||||||
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
#[serial]
|
#[serial]
|
||||||
async fn creator_info() -> LemmyResult<()> {
|
async fn creator_info() -> LemmyResult<()> {
|
||||||
|
|
Loading…
Reference in a new issue