test_email_change: Cover the case of email already existing.

This fixes master failing tests.
This commit is contained in:
Tim Abbott 2017-09-26 11:15:37 -07:00
parent 358cb40ed1
commit e5ea598fe3
1 changed files with 14 additions and 0 deletions

View File

@ -143,6 +143,20 @@ class EmailChangeTestCase(ZulipTestCase):
self.assert_in_response("Email address changes are disabled in this organization.", self.assert_in_response("Email address changes are disabled in this organization.",
result) result)
def test_email_change_already_taken(self):
# type: () -> None
data = {'email': 'cordelia@zulip.com'}
user_profile = self.example_user('hamlet')
email = user_profile.email
self.login(email)
url = '/json/settings'
result = self.client_patch(url, data)
self.assertEqual(len(mail.outbox), 0)
self.assertEqual(result.status_code, 400)
self.assert_in_response("Already has an account",
result)
def test_unauthorized_email_change_from_email_confirmation_link(self): def test_unauthorized_email_change_from_email_confirmation_link(self):
# type: () -> None # type: () -> None
data = {'email': 'hamlet-new@zulip.com'} data = {'email': 'hamlet-new@zulip.com'}