Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
tests: Assert specific log lines instead of fuzzy `any()` matches.
Mateusz Mandera574f63bccf1d
diff --git a/.claude/CLAUDE.md b/.claude/CLAUDE.mdindex 9137450dffa..e3f6817d5bd 100644--- a/.claude/CLAUDE.md+++ b/.claude/CLAUDE.md@@ -506,6 +506,10 @@ faster and easier to just plan and write them well the first time.foos = {f.id: f for f in Foo.objects.filter(id__in=[b.foo_id for b in bars])}```+- In tests, don't assert on `assertLogs` output with+ `any(phrase in line for line in mock_log.output)`; pin the full line+ against `mock_log.output`, or a substring to a specific `mock_log.output[i]`.+### Process:- Always check if you're working on top of the latest upstream/main, anddiff --git a/zerver/tests/test_auth_backends.py b/zerver/tests/test_auth_backends.pyindex 87cbd2964e2..747a0c90ae9 100644--- a/zerver/tests/test_auth_backends.py+++ b/zerver/tests/test_auth_backends.py@@ -4433,8 +4433,10 @@ class SAMLAuthBackendTest(SocialAuthBase):hamlet.refresh_from_db()# Email should NOT have changed.self.assertEqual(hamlet.delivery_email, self.email)- self.assertTrue(- any("Can't sync email" in output for output in m.output),+ self.assertIn(+ f"Can't sync email for user {hamlet.id}: "+ f"another user exists with target email {othello_email}",+ m.output[1],)def test_external_auth_id_saml_cross_realm_bot_email(self) -> None:@@ -4480,8 +4482,9 @@ class SAMLAuthBackendTest(SocialAuthBase):hamlet.refresh_from_db()# Email should NOT have changed.self.assertEqual(hamlet.delivery_email, self.email)- self.assertTrue(- any("reserved for system bots" in output for output in m.output),+ self.assertIn(+ f"Can't sync email for user {hamlet.id}: {bot_email} is reserved for system bots",+ m.output[1],)def test_external_auth_id_saml_deactivated_user(self) -> None: