mirror of
https://github.com/zulip/zulip.git
synced 2025-11-15 03:11:54 +00:00
test_auth_backends: Remove now-unnecessary compatibility code.
This code was added as part of the Django 1.10 migration to make our tests work with both Django 1.8 and 1.10. Now that we're on 1.10, it's no longer required.
This commit is contained in:
@@ -1014,24 +1014,16 @@ class TestDevAuthBackend(ZulipTestCase):
|
||||
data = {'direct_email': email}
|
||||
with self.settings(AUTHENTICATION_BACKENDS=('zproject.backends.EmailAuthBackend',)):
|
||||
with self.assertRaisesRegex(Exception, 'Direct login not supported.'):
|
||||
try:
|
||||
with mock.patch('django.core.handlers.exception.logger'):
|
||||
self.client_post('/accounts/login/local/', data)
|
||||
except ImportError:
|
||||
with mock.patch('django.core.handlers.base.logger'):
|
||||
self.client_post('/accounts/login/local/', data)
|
||||
with mock.patch('django.core.handlers.exception.logger'):
|
||||
self.client_post('/accounts/login/local/', data)
|
||||
|
||||
def test_login_failure_due_to_nonexistent_user(self):
|
||||
# type: () -> None
|
||||
email = 'nonexisting@zulip.com'
|
||||
data = {'direct_email': email}
|
||||
with self.assertRaisesRegex(Exception, 'User cannot login'):
|
||||
try:
|
||||
with mock.patch('django.core.handlers.exception.logger'):
|
||||
self.client_post('/accounts/login/local/', data)
|
||||
except ImportError:
|
||||
with mock.patch('django.core.handlers.base.logger'):
|
||||
self.client_post('/accounts/login/local/', data)
|
||||
with mock.patch('django.core.handlers.exception.logger'):
|
||||
self.client_post('/accounts/login/local/', data)
|
||||
|
||||
class TestZulipRemoteUserBackend(ZulipTestCase):
|
||||
def test_login_success(self):
|
||||
|
||||
Reference in New Issue
Block a user