- };
-
- // Test a community block
- let community_block = CommunityBlockForm {
- person_id: inserted_person.id,
- community_id: inserted_community.id,
- };
- CommunityBlock::block(&conn, &community_block).unwrap();
-
- let read_post_listings_with_person_after_block = PostQuery::builder()
- .conn(&conn)
- .sort(Some(SortType::New))
- .show_bot_accounts(Some(false))
- .community_id(Some(inserted_community.id))
- .my_person_id(Some(inserted_person.id))
- .build()
- .list()
- .unwrap();
-
- // TODO More needs to be added here
- let mut expected_post_listing_with_user = expected_post_listing_no_person.to_owned();
- expected_post_listing_with_user.my_vote = Some(1);
-
- let like_removed = PostLike::remove(&conn, inserted_person.id, inserted_post.id).unwrap();
- let num_deleted = Post::delete(&conn, inserted_post.id).unwrap();
- PersonBlock::unblock(&conn, &person_block).unwrap();
- CommunityBlock::unblock(&conn, &community_block).unwrap();
- Community::delete(&conn, inserted_community.id).unwrap();
- Person::delete(&conn, inserted_person.id).unwrap();
- Person::delete(&conn, inserted_bot.id).unwrap();
- Person::delete(&conn, inserted_blocked_person.id).unwrap();
-
- // The with user
- assert_eq!(
- expected_post_listing_with_user,
- read_post_listings_with_person[0]
- );
- assert_eq!(
- expected_post_listing_with_user,
- read_post_listing_with_person
- );
-
- // Should be only one person, IE the bot post, and blocked should be missing
- assert_eq!(1, read_post_listings_with_person.len());
-
- // Without the user
- assert_eq!(
- expected_post_listing_no_person,
- read_post_listings_no_person[1]
- );
- assert_eq!(expected_post_listing_no_person, read_post_listing_no_person);
-
- // Should be 2 posts, with the bot post, and the blocked
- assert_eq!(3, read_post_listings_no_person.len());
-
- // Should be 0 posts after the community block
- assert_eq!(0, read_post_listings_with_person_after_block.len());
-
- assert_eq!(expected_post_like, inserted_post_like);
- assert_eq!(1, like_removed);
- assert_eq!(1, num_deleted);