mirror of https://github.com/zulip/zulip.git
Add test_api_with_nonexistent_user().
This commit is contained in:
parent
f43be3bd8f
commit
cee47e7f82
|
@ -495,10 +495,24 @@ class ActivateTest(AuthedTestCase):
|
|||
user = get_user_profile_by_email('hamlet@zulip.com')
|
||||
self.assertTrue(user.is_active)
|
||||
|
||||
# Can not deactivate a user as a bot
|
||||
def test_api_with_nonexistent_user(self):
|
||||
# type: () -> None
|
||||
admin = get_user_profile_by_email('othello@zulip.com')
|
||||
do_change_is_admin(admin, True)
|
||||
self.login('othello@zulip.com')
|
||||
|
||||
# Can not deactivate a user with the bot api
|
||||
result = self.client_delete('/json/bots/hamlet@zulip.com')
|
||||
self.assert_json_error(result, 'No such bot')
|
||||
|
||||
# Can not deactivate a nonexistent user.
|
||||
result = self.client_delete('/json/users/nonexistent@zulip.com')
|
||||
self.assert_json_error(result, 'No such user')
|
||||
|
||||
# Can not reactivate a nonexistent user.
|
||||
result = self.client.post('/json/users/nonexistent@zulip.com/reactivate')
|
||||
self.assert_json_error(result, 'No such user')
|
||||
|
||||
@skip_py3
|
||||
class BotTest(AuthedTestCase):
|
||||
def assert_num_bots_equal(self, count):
|
||||
|
|
Loading…
Reference in New Issue