Add missing test cleanup (#4289)

* Add missing test cleanup

* cleanup
This commit is contained in:
Nutomic 2023-12-19 11:26:00 +01:00 committed by GitHub
parent 2899ba0131
commit a507a39336
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 9 deletions

View File

@ -210,7 +210,7 @@ mod tests {
.recipient_id(timmy.id)
.content(message_content.clone())
.build();
let _inserted_sara_timmy_message_form = PrivateMessage::create(pool, &sara_timmy_message_form)
PrivateMessage::create(pool, &sara_timmy_message_form)
.await
.unwrap();
@ -219,7 +219,7 @@ mod tests {
.recipient_id(jess.id)
.content(message_content.clone())
.build();
let _inserted_sara_jess_message_form = PrivateMessage::create(pool, &sara_jess_message_form)
PrivateMessage::create(pool, &sara_jess_message_form)
.await
.unwrap();
@ -228,7 +228,7 @@ mod tests {
.recipient_id(sara.id)
.content(message_content.clone())
.build();
let _inserted_timmy_sara_message_form = PrivateMessage::create(pool, &timmy_sara_message_form)
PrivateMessage::create(pool, &timmy_sara_message_form)
.await
.unwrap();
@ -237,13 +237,13 @@ mod tests {
.recipient_id(timmy.id)
.content(message_content.clone())
.build();
let _inserted_jess_timmy_message_form = PrivateMessage::create(pool, &jess_timmy_message_form)
PrivateMessage::create(pool, &jess_timmy_message_form)
.await
.unwrap();
let timmy_messages = PrivateMessageQuery {
unread_only: false,
creator_id: Option::None,
creator_id: None,
..Default::default()
}
.list(pool, timmy.id)
@ -260,7 +260,7 @@ mod tests {
let timmy_unread_messages = PrivateMessageQuery {
unread_only: true,
creator_id: Option::None,
creator_id: None,
..Default::default()
}
.list(pool, timmy.id)
@ -320,7 +320,7 @@ mod tests {
let timmy_messages = PrivateMessageQuery {
unread_only: true,
creator_id: Option::None,
creator_id: None,
..Default::default()
}
.list(pool, timmy.id)
@ -333,5 +333,8 @@ mod tests {
.await
.unwrap();
assert_eq!(timmy_unread_messages, 1);
// This also deletes all persons and private messages thanks to sql `on delete cascade`
Instance::delete(pool, instance.id).await.unwrap();
}
}

View File

@ -230,7 +230,6 @@ mod tests {
#[tokio::test]
#[serial]
#[allow(clippy::dbg_macro)]
async fn exclude_deleted() {
let pool = &build_db_pool_for_tests().await;
let pool = &mut pool.into();
@ -257,7 +256,6 @@ mod tests {
.list(pool)
.await
.unwrap();
dbg!(&list);
assert_eq!(list.len(), 1);
assert_eq!(list[0].person.id, data.bob.id);