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_cache: Use assertLogs to avoid spam in test-backend output.

Mohit Gupta4928b5599688
diff --git a/zerver/tests/test_cache.py b/zerver/tests/test_cache.py
index e7cf0e51e3a..f0f76c5bb68 100644
--- a/zerver/tests/test_cache.py
+++ b/zerver/tests/test_cache.py
@@ -295,8 +295,12 @@ class GenericBulkCachedFetchTest(ZulipTestCase):
id_fetcher=get_user_email,
)
self.assertEqual(result, {hamlet.delivery_email: hamlet})
+ with self.assertLogs(level='INFO') as info_log:
+ flush_cache(Mock())
+ self.assertEqual(info_log.output, [
+ 'INFO:root:Clearing memcached cache after migrations'
+ ])
- flush_cache(Mock())
# With the cache flushed, the query_function should get called:
with self.assertRaises(CustomException):
result = bulk_cached_fetch(