}
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;
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);
}
#[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;
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);
}