X-Git-Url: http://these/git/?a=blobdiff_plain;f=crates%2Fapub%2Fsrc%2Fobjects%2Fcomment.rs;h=41d7f19da0a28521fef7e47b706896c09b129f47;hb=c9f140742925d6da20103124b49f2b58a35fc2b8;hp=840d3a511e059ef4fab3f41aff533c56077790b6;hpb=4e6409f325bca5b2727b19c24d77ffa2b59109b1;p=lemmy.git diff --git a/crates/apub/src/objects/comment.rs b/crates/apub/src/objects/comment.rs index 840d3a51..41d7f19d 100644 --- a/crates/apub/src/objects/comment.rs +++ b/crates/apub/src/objects/comment.rs @@ -249,16 +249,18 @@ pub(crate) mod tests { } fn cleanup(data: (ApubPerson, ApubCommunity, ApubPost, ApubSite), context: &LemmyContext) { - Post::delete(&*context.pool().get().unwrap(), data.2.id).unwrap(); - Community::delete(&*context.pool().get().unwrap(), data.1.id).unwrap(); - Person::delete(&*context.pool().get().unwrap(), data.0.id).unwrap(); - Site::delete(&*context.pool().get().unwrap(), data.3.id).unwrap(); + let conn = &mut context.pool().get().unwrap(); + Post::delete(conn, data.2.id).unwrap(); + Community::delete(conn, data.1.id).unwrap(); + Person::delete(conn, data.0.id).unwrap(); + Site::delete(conn, data.3.id).unwrap(); } #[actix_rt::test] #[serial] pub(crate) async fn test_parse_lemmy_comment() { let context = init_context(); + let conn = &mut context.pool().get().unwrap(); let url = Url::parse("https://enterprise.lemmy.ml/comment/38741").unwrap(); let data = prepare_comment_test(&url, &context).await; @@ -280,7 +282,7 @@ pub(crate) mod tests { let to_apub = comment.into_apub(&context).await.unwrap(); assert_json_include!(actual: json, expected: to_apub); - Comment::delete(&*context.pool().get().unwrap(), comment_id).unwrap(); + Comment::delete(conn, comment_id).unwrap(); cleanup(data, &context); } @@ -288,6 +290,7 @@ pub(crate) mod tests { #[serial] async fn test_parse_pleroma_comment() { let context = init_context(); + let conn = &mut context.pool().get().unwrap(); let url = Url::parse("https://enterprise.lemmy.ml/comment/38741").unwrap(); let data = prepare_comment_test(&url, &context).await; @@ -315,7 +318,7 @@ pub(crate) mod tests { assert!(!comment.local); assert_eq!(request_counter, 0); - Comment::delete(&*context.pool().get().unwrap(), comment.id).unwrap(); + Comment::delete(conn, comment.id).unwrap(); cleanup(data, &context); }