mirror of
https://github.com/LemmyNet/lemmy.git
synced 2025-01-07 10:42:19 +00:00
Fixing unit tests.
This commit is contained in:
parent
b108938274
commit
d60a58bd6e
9 changed files with 30 additions and 4 deletions
|
@ -141,5 +141,9 @@ mod tests {
|
|||
Person::delete(&conn, another_inserted_person.id).unwrap();
|
||||
let person_num_deleted = Person::delete(&conn, inserted_person.id).unwrap();
|
||||
assert_eq!(1, person_num_deleted);
|
||||
|
||||
// Delete the community
|
||||
let community_num_deleted = Community::delete(&conn, inserted_community.id).unwrap();
|
||||
assert_eq!(1, community_num_deleted);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -167,6 +167,14 @@ mod tests {
|
|||
let person_num_deleted = Person::delete(&conn, inserted_person.id).unwrap();
|
||||
assert_eq!(1, person_num_deleted);
|
||||
|
||||
// Delete the community
|
||||
let community_num_deleted = Community::delete(&conn, inserted_community.id).unwrap();
|
||||
assert_eq!(1, community_num_deleted);
|
||||
|
||||
let another_community_num_deleted =
|
||||
Community::delete(&conn, another_inserted_community.id).unwrap();
|
||||
assert_eq!(1, another_community_num_deleted);
|
||||
|
||||
// Should be none found, since the creator was deleted
|
||||
let after_delete = CommunityAggregates::read(&conn, inserted_community.id);
|
||||
assert!(after_delete.is_err());
|
||||
|
|
|
@ -159,6 +159,10 @@ mod tests {
|
|||
assert_eq!(1, person_num_deleted);
|
||||
Person::delete(&conn, another_inserted_person.id).unwrap();
|
||||
|
||||
// Delete the community
|
||||
let community_num_deleted = Community::delete(&conn, inserted_community.id).unwrap();
|
||||
assert_eq!(1, community_num_deleted);
|
||||
|
||||
// Should be none found
|
||||
let after_delete = PersonAggregates::read(&conn, inserted_person.id);
|
||||
assert!(after_delete.is_err());
|
||||
|
|
|
@ -148,6 +148,10 @@ mod tests {
|
|||
let person_num_deleted = Person::delete(&conn, inserted_person.id).unwrap();
|
||||
assert_eq!(1, person_num_deleted);
|
||||
|
||||
// Delete the community
|
||||
let community_num_deleted = Community::delete(&conn, inserted_community.id).unwrap();
|
||||
assert_eq!(1, community_num_deleted);
|
||||
|
||||
// Should be none found, since the creator was deleted
|
||||
let after_delete = PostAggregates::read(&conn, inserted_post.id);
|
||||
assert!(after_delete.is_err());
|
||||
|
|
|
@ -118,6 +118,10 @@ mod tests {
|
|||
let person_num_deleted = Person::delete(&conn, inserted_person.id).unwrap();
|
||||
assert_eq!(1, person_num_deleted);
|
||||
|
||||
// Delete the community
|
||||
let community_num_deleted = Community::delete(&conn, inserted_community.id).unwrap();
|
||||
assert_eq!(1, community_num_deleted);
|
||||
|
||||
let after_delete = SiteAggregates::read(&conn);
|
||||
assert!(after_delete.is_err());
|
||||
}
|
||||
|
|
|
@ -231,6 +231,7 @@ mod tests {
|
|||
|
||||
let new_post = PostForm {
|
||||
name: "A test post thweep".into(),
|
||||
creator_id: inserted_person.id,
|
||||
community_id: inserted_community.id,
|
||||
..PostForm::default()
|
||||
};
|
||||
|
|
|
@ -112,6 +112,7 @@ mod tests {
|
|||
|
||||
let new_post = PostForm {
|
||||
name: "A test post".into(),
|
||||
creator_id: inserted_person.id,
|
||||
community_id: inserted_community.id,
|
||||
..PostForm::default()
|
||||
};
|
||||
|
|
|
@ -56,8 +56,8 @@ pub struct CommentAlias1 {
|
|||
pub struct CommentForm {
|
||||
pub creator_id: PersonId,
|
||||
pub post_id: PostId,
|
||||
pub parent_id: Option<CommentId>,
|
||||
pub content: String,
|
||||
pub parent_id: Option<CommentId>,
|
||||
pub removed: Option<bool>,
|
||||
pub read: Option<bool>,
|
||||
pub published: Option<chrono::NaiveDateTime>,
|
||||
|
|
|
@ -35,16 +35,16 @@ pub struct Post {
|
|||
#[table_name = "post"]
|
||||
pub struct PostForm {
|
||||
pub name: String,
|
||||
pub url: Option<DbUrl>,
|
||||
pub body: Option<String>,
|
||||
pub creator_id: PersonId,
|
||||
pub community_id: CommunityId,
|
||||
pub nsfw: bool,
|
||||
pub url: Option<DbUrl>,
|
||||
pub body: Option<String>,
|
||||
pub removed: Option<bool>,
|
||||
pub locked: Option<bool>,
|
||||
pub published: Option<chrono::NaiveDateTime>,
|
||||
pub updated: Option<chrono::NaiveDateTime>,
|
||||
pub deleted: Option<bool>,
|
||||
pub nsfw: bool,
|
||||
pub stickied: Option<bool>,
|
||||
pub embed_title: Option<String>,
|
||||
pub embed_description: Option<String>,
|
||||
|
|
Loading…
Reference in a new issue