bots: Add test for invalid bot type.

This commit is contained in:
Tim Abbott 2017-06-06 21:16:18 -07:00
parent 60ff82ed7c
commit 4efdf85f62
1 changed files with 14 additions and 0 deletions

View File

@ -500,6 +500,20 @@ class BotTest(ZulipTestCase, UploadSerializeMixin):
profile = get_user(bot_email, bot_realm) profile = get_user(bot_email, bot_realm)
self.assertEqual(profile.bot_type, UserProfile.INCOMING_WEBHOOK_BOT) self.assertEqual(profile.bot_type, UserProfile.INCOMING_WEBHOOK_BOT)
def test_add_bot_with_bot_type_invalid(self):
# type: () -> None
bot_info = {
'full_name': 'The Bot of Hamlet',
'short_name': 'hambot',
'bot_type': 7,
}
self.login(self.example_email('hamlet'))
self.assert_num_bots_equal(0)
result = self.client_post("/json/bots", bot_info)
self.assert_num_bots_equal(0)
self.assert_json_error(result, 'Invalid bot type')
def test_patch_bot_full_name(self): def test_patch_bot_full_name(self):
# type: () -> None # type: () -> None
self.login(self.example_email('hamlet')) self.login(self.example_email('hamlet'))