mypy: Add assertions to test_bots.py to satisfy mypy.

This commit is contained in:
neiljp (Neil Pilgrim) 2018-02-19 01:47:03 +00:00 committed by Tim Abbott
parent 3a301acf4b
commit 15b16c23a1
1 changed files with 5 additions and 0 deletions

View File

@ -210,6 +210,7 @@ class BotTest(ZulipTestCase, UploadSerializeMixin):
self.assertEqual(result['default_sending_stream'], 'Denmark') self.assertEqual(result['default_sending_stream'], 'Denmark')
profile = get_user(email, realm) profile = get_user(email, realm)
assert(profile.default_sending_stream is not None)
self.assertEqual(profile.default_sending_stream.name, 'Denmark') self.assertEqual(profile.default_sending_stream.name, 'Denmark')
def test_add_bot_with_default_sending_stream_not_subscribed(self) -> None: def test_add_bot_with_default_sending_stream_not_subscribed(self) -> None:
@ -222,6 +223,7 @@ class BotTest(ZulipTestCase, UploadSerializeMixin):
self.assertEqual(result['default_sending_stream'], 'Rome') self.assertEqual(result['default_sending_stream'], 'Rome')
profile = get_user(email, realm) profile = get_user(email, realm)
assert(profile.default_sending_stream is not None)
self.assertEqual(profile.default_sending_stream.name, 'Rome') self.assertEqual(profile.default_sending_stream.name, 'Rome')
def test_bot_add_subscription(self) -> None: def test_bot_add_subscription(self) -> None:
@ -286,6 +288,7 @@ class BotTest(ZulipTestCase, UploadSerializeMixin):
email = 'hambot-bot@zulip.testserver' email = 'hambot-bot@zulip.testserver'
realm = get_realm('zulip') realm = get_realm('zulip')
profile = get_user(email, realm) profile = get_user(email, realm)
assert(profile.default_sending_stream is not None)
self.assertEqual(profile.default_sending_stream.name, 'Denmark') self.assertEqual(profile.default_sending_stream.name, 'Denmark')
event = [e for e in events if e['event']['type'] == 'realm_bot'][0] event = [e for e in events if e['event']['type'] == 'realm_bot'][0]
@ -336,6 +339,7 @@ class BotTest(ZulipTestCase, UploadSerializeMixin):
self.assertEqual(result['default_events_register_stream'], 'Denmark') self.assertEqual(result['default_events_register_stream'], 'Denmark')
profile = get_user(bot_email, bot_realm) profile = get_user(bot_email, bot_realm)
assert(profile.default_events_register_stream is not None)
self.assertEqual(profile.default_events_register_stream.name, 'Denmark') self.assertEqual(profile.default_events_register_stream.name, 'Denmark')
def test_add_bot_with_default_events_register_stream_private_allowed(self) -> None: def test_add_bot_with_default_events_register_stream_private_allowed(self) -> None:
@ -354,6 +358,7 @@ class BotTest(ZulipTestCase, UploadSerializeMixin):
bot_email = 'hambot-bot@zulip.testserver' bot_email = 'hambot-bot@zulip.testserver'
bot_realm = get_realm('zulip') bot_realm = get_realm('zulip')
bot_profile = get_user(bot_email, bot_realm) bot_profile = get_user(bot_email, bot_realm)
assert(bot_profile.default_events_register_stream is not None)
self.assertEqual(bot_profile.default_events_register_stream.name, 'Denmark') self.assertEqual(bot_profile.default_events_register_stream.name, 'Denmark')
event = [e for e in events if e['event']['type'] == 'realm_bot'][0] event = [e for e in events if e['event']['type'] == 'realm_bot'][0]