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:
Tim Abbott
2017-03-04 23:37:39 -08:00
parent 39704bac6c
commit 6c12a49d04
2 changed files with 4 additions and 13 deletions

View File

@@ -82,7 +82,6 @@ not_yet_fully_covered = {
'zerver/models.py', 'zerver/models.py',
# Test files should have full coverage; it's a bug in the test if # Test files should have full coverage; it's a bug in the test if
# they don't! # they don't!
'zerver/tests/test_auth_backends.py',
'zerver/tests/test_narrow.py', 'zerver/tests/test_narrow.py',
'zerver/tests/test_tornado.py', 'zerver/tests/test_tornado.py',
'zerver/tests/test_urls.py', 'zerver/tests/test_urls.py',

View File

@@ -1014,24 +1014,16 @@ class TestDevAuthBackend(ZulipTestCase):
data = {'direct_email': email} data = {'direct_email': email}
with self.settings(AUTHENTICATION_BACKENDS=('zproject.backends.EmailAuthBackend',)): with self.settings(AUTHENTICATION_BACKENDS=('zproject.backends.EmailAuthBackend',)):
with self.assertRaisesRegex(Exception, 'Direct login not supported.'): with self.assertRaisesRegex(Exception, 'Direct login not supported.'):
try: with mock.patch('django.core.handlers.exception.logger'):
with mock.patch('django.core.handlers.exception.logger'): self.client_post('/accounts/login/local/', data)
self.client_post('/accounts/login/local/', data)
except ImportError:
with mock.patch('django.core.handlers.base.logger'):
self.client_post('/accounts/login/local/', data)
def test_login_failure_due_to_nonexistent_user(self): def test_login_failure_due_to_nonexistent_user(self):
# type: () -> None # type: () -> None
email = 'nonexisting@zulip.com' email = 'nonexisting@zulip.com'
data = {'direct_email': email} data = {'direct_email': email}
with self.assertRaisesRegex(Exception, 'User cannot login'): with self.assertRaisesRegex(Exception, 'User cannot login'):
try: with mock.patch('django.core.handlers.exception.logger'):
with mock.patch('django.core.handlers.exception.logger'): self.client_post('/accounts/login/local/', data)
self.client_post('/accounts/login/local/', data)
except ImportError:
with mock.patch('django.core.handlers.base.logger'):
self.client_post('/accounts/login/local/', data)
class TestZulipRemoteUserBackend(ZulipTestCase): class TestZulipRemoteUserBackend(ZulipTestCase):
def test_login_success(self): def test_login_success(self):