Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

test_sessions: Use assertLogs to avoid spam in test-backend output.

Mohit Guptadbbacdd3d9aa
diff --git a/zerver/tests/test_sessions.py b/zerver/tests/test_sessions.py
index 5b096201a4f..63e2f2c9d40 100644
--- a/zerver/tests/test_sessions.py
+++ b/zerver/tests/test_sessions.py
@@ -89,7 +89,11 @@ class TestSessions(ZulipTestCase):
self.assertIn('_auth_user_id', self.client.session)
user_profile_3.is_active = False
user_profile_3.save()
- delete_all_deactivated_user_sessions()
+ with self.assertLogs(level='INFO') as info_logs:
+ delete_all_deactivated_user_sessions()
+ self.assertEqual(info_logs.output, [
+ 'INFO:root:Deactivating session for deactivated user 8'
+ ])
result = self.client_get("/")
self.assertEqual('/login/', result.url)