auth: Fix GitHub test for invalid user account.

This commit is contained in:
Tim Abbott 2017-11-21 15:45:17 -08:00 committed by Greg Price
parent 251a537e0d
commit 0377288f68
1 changed files with 6 additions and 7 deletions

View File

@ -507,13 +507,12 @@ class GitHubAuthBackendTest(ZulipTestCase):
def test_github_backend_authenticate_nonexisting_user(self): def test_github_backend_authenticate_nonexisting_user(self):
# type: () -> None # type: () -> None
with mock.patch('zproject.backends.get_user_profile_by_email', self.backend.strategy.session_set('subdomain', 'zulip')
side_effect=UserProfile.DoesNotExist("Do not exist")): response = dict(email="invalid@zulip.com", name=self.name)
response = dict(email=self.email, name=self.name) return_data = dict() # type: Dict[str, Any]
return_data = dict() # type: Dict[str, Any] user = self.backend.authenticate(return_data=return_data, response=response)
user = self.backend.authenticate(return_data=return_data, response=response) self.assertIs(user, None)
self.assertIs(user, None) self.assertTrue(return_data['valid_attestation'])
self.assertTrue(return_data['valid_attestation'])
def test_github_backend_authenticate_invalid_email(self): def test_github_backend_authenticate_invalid_email(self):
# type: () -> None # type: () -> None