]> Untitled Git - lemmy.git/commitdiff
Remove tests for unimplemented Crud::delete functions (#87)
authornutomic <nutomic@noreply.yerbamate.dev>
Mon, 17 Aug 2020 20:50:44 +0000 (20:50 +0000)
committerdessalines <dessalines@noreply.yerbamate.dev>
Mon, 17 Aug 2020 20:50:44 +0000 (20:50 +0000)
Remove tests for unimplemented Crud::delete functions

Co-authored-by: Felix Ableitner <me@nutomic.com>
Reviewed-on: https://yerbamate.dev/LemmyNet/lemmy/pulls/87

server/lemmy_db/src/activity.rs
server/lemmy_db/src/comment.rs
server/lemmy_db/src/community_view.rs
server/lemmy_db/src/moderator.rs
server/lemmy_db/src/private_message.rs
server/lemmy_db/src/user_mention.rs

index a832334267f77b6efba1ffb2a91d498ddbf1c9e7..177e6b7cd6221074bff6b228804d73424f8e6b75 100644 (file)
@@ -151,11 +151,9 @@ mod tests {
     };
 
     let read_activity = Activity::read(&conn, inserted_activity.id).unwrap();
-    let num_deleted = Activity::delete(&conn, inserted_activity.id).unwrap();
     User_::delete(&conn, inserted_creator.id).unwrap();
 
     assert_eq!(expected_activity, read_activity);
     assert_eq!(expected_activity, inserted_activity);
-    assert_eq!(1, num_deleted);
   }
 }
index 8e52d7e2d4f17f5d34862951e8c1fca33d954695..8171f6b8763af979aa4d7633416c3fbde6176d87 100644 (file)
@@ -149,10 +149,7 @@ impl Comment {
       .get_result::<Self>(conn)
   }
 
-  pub fn upsert(
-    conn: &PgConnection,
-    comment_form: &CommentForm,
-  ) -> Result<Self, Error> {
+  pub fn upsert(conn: &PgConnection, comment_form: &CommentForm) -> Result<Self, Error> {
     let existing = Self::read_from_apub_id(conn, &comment_form.ap_id);
     match existing {
       Err(NotFound {}) => Ok(Self::create(conn, &comment_form)?),
index 1d47c7d7ed398560de2a60b854952dd5a7767ac0..e8353779c964e3cd8200d5ea7abde2a85139d82c 100644 (file)
@@ -251,7 +251,7 @@ impl<'a> CommunityQueryBuilder<'a> {
           .order_by(hot_rank.desc())
           .then_order_by(number_of_subscribers.desc())
           .filter(user_id.is_null())
-      },
+      }
     };
 
     if !self.show_nsfw {
index 70c253fe3acb34e699b4dee5036072e942d3d52e..1a02d977ca222d6ed53b8d230f327b921a04cbb4 100644 (file)
@@ -707,16 +707,6 @@ mod tests {
       when_: inserted_mod_add.when_,
     };
 
-    ModRemovePost::delete(&conn, inserted_mod_remove_post.id).unwrap();
-    ModLockPost::delete(&conn, inserted_mod_lock_post.id).unwrap();
-    ModStickyPost::delete(&conn, inserted_mod_sticky_post.id).unwrap();
-    ModRemoveComment::delete(&conn, inserted_mod_remove_comment.id).unwrap();
-    ModRemoveCommunity::delete(&conn, inserted_mod_remove_community.id).unwrap();
-    ModBanFromCommunity::delete(&conn, inserted_mod_ban_from_community.id).unwrap();
-    ModBan::delete(&conn, inserted_mod_ban.id).unwrap();
-    ModAddCommunity::delete(&conn, inserted_mod_add_community.id).unwrap();
-    ModAdd::delete(&conn, inserted_mod_add.id).unwrap();
-
     Comment::delete(&conn, inserted_comment.id).unwrap();
     Post::delete(&conn, inserted_post.id).unwrap();
     Community::delete(&conn, inserted_community.id).unwrap();
index 16c6f9bf86d83e47f0021e825fa6763224afc97b..007a962084d54ea7268754a515195a8afe9b4e73 100644 (file)
@@ -225,7 +225,6 @@ mod tests {
       PrivateMessage::update_deleted(&conn, inserted_private_message.id, true).unwrap();
     let marked_read_private_message =
       PrivateMessage::update_read(&conn, inserted_private_message.id, true).unwrap();
-    let num_deleted = PrivateMessage::delete(&conn, inserted_private_message.id).unwrap();
     User_::delete(&conn, inserted_creator.id).unwrap();
     User_::delete(&conn, inserted_recipient.id).unwrap();
 
@@ -234,6 +233,5 @@ mod tests {
     assert_eq!(expected_private_message, inserted_private_message);
     assert!(deleted_private_message.deleted);
     assert!(marked_read_private_message.read);
-    assert_eq!(1, num_deleted);
   }
 }
index a8ec88d21a22417710f1bf8185d7cd8111e44120..4c0fdc5ff85d0fb808d2371a8e1a15bde5749949 100644 (file)
@@ -224,7 +224,6 @@ mod tests {
     let read_mention = UserMention::read(&conn, inserted_mention.id).unwrap();
     let updated_mention =
       UserMention::update(&conn, inserted_mention.id, &user_mention_form).unwrap();
-    let num_deleted = UserMention::delete(&conn, inserted_mention.id).unwrap();
     Comment::delete(&conn, inserted_comment.id).unwrap();
     Post::delete(&conn, inserted_post.id).unwrap();
     Community::delete(&conn, inserted_community.id).unwrap();
@@ -234,6 +233,5 @@ mod tests {
     assert_eq!(expected_mention, read_mention);
     assert_eq!(expected_mention, inserted_mention);
     assert_eq!(expected_mention, updated_mention);
-    assert_eq!(1, num_deleted);
   }
 }