mirror of
https://github.com/chatmail/core.git
synced 2026-10-02 03:00:40 +03:00
test: Assert log warnings and errors (#8457)
Adds `assert_warn`, `assert_error` and `assert_warns_or_errors` methods to `TestContext`, that let us assert that a certain warning or error is logged during the test. Also asserts test logs should not contain any other errors or warnings. Adjusts tests accordingly. Signed-off-by: Jagoda Ślązak <jslazak@jslazak.com>
This commit is contained in:
+3
-3
@@ -2454,7 +2454,7 @@ async fn handle_post_message(
|
||||
.context("expected Post-Message to have a message id")?;
|
||||
|
||||
let Some(msg_id) = message::rfc724_mid_exists(context, &rfc724_mid).await? else {
|
||||
warn!(
|
||||
info!(
|
||||
context,
|
||||
"handle_post_message: {rfc724_mid}: Database entry does not exist."
|
||||
);
|
||||
@@ -3465,13 +3465,13 @@ async fn group_changes_msgs(
|
||||
) -> Result<Vec<(String, SystemMessage, Option<ContactId>)>> {
|
||||
let mut group_changes_msgs: Vec<(String, SystemMessage, Option<ContactId>)> = Vec::new();
|
||||
if !added_ids.is_empty() {
|
||||
warn!(
|
||||
info!(
|
||||
context,
|
||||
"Implicit addition of {added_ids:?} to chat {chat_id}."
|
||||
);
|
||||
}
|
||||
if !removed_ids.is_empty() {
|
||||
warn!(
|
||||
info!(
|
||||
context,
|
||||
"Implicit removal of {removed_ids:?} from chat {chat_id}."
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user