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

This commit is contained in:
Mohit Gupta 2020-07-26 05:06:50 +05:30 committed by Tim Abbott
parent 133a5f2a7c
commit 4928b55996
1 changed files with 5 additions and 1 deletions

View File

@ -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(