mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 13:03:29 +00:00
logging: Migrate many backend tests to use assertLogs.
This commit migrates some of the backend tests to use assertLogs(), instead of mock.patch() as planned in #15331. Tweaked by tabbott to avoid tautological assertions.
This commit is contained in:
committed by
Tim Abbott
parent
7417ac9165
commit
ccf520ff13
@@ -455,10 +455,9 @@ class HomeTest(ZulipTestCase):
|
||||
|
||||
def test_bad_narrow(self) -> None:
|
||||
self.login('hamlet')
|
||||
with patch('logging.warning') as mock:
|
||||
with self.assertLogs(level='WARNING') as m:
|
||||
result = self._get_home_page(stream='Invalid Stream')
|
||||
mock.assert_called_once()
|
||||
self.assertEqual(mock.call_args_list[0][0][0], "Invalid narrow requested, ignoring")
|
||||
self.assertEqual(m.output, ['WARNING:root:Invalid narrow requested, ignoring'])
|
||||
self._sanity_check(result)
|
||||
|
||||
def test_topic_narrow(self) -> None:
|
||||
|
||||
Reference in New Issue
Block a user