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:
Jagoda Estera Ślązak
2026-08-10 13:36:09 +00:00
committed by GitHub
parent 97932fda07
commit fd8c56894a
36 changed files with 554 additions and 219 deletions
+4
View File
@@ -584,6 +584,10 @@ async fn test_withdraw_joinbroadcast() -> Result<()> {
assert_eq!(bob_chat.is_self_in_chat(bob).await?, true);
assert_eq!(get_chat_contacts(alice, chat_id).await?.len(), 1);
alice
.assert_warn("Could not find symmetric secret for session key")
.await;
alice.assert_warn("unencrypted message").await;
Ok(())
}