diff --git a/tools/test-backend b/tools/test-backend index 081bf1d982..3a02ca2fb4 100755 --- a/tools/test-backend +++ b/tools/test-backend @@ -82,7 +82,6 @@ not_yet_fully_covered = { 'zerver/models.py', # Test files should have full coverage; it's a bug in the test if # they don't! - 'zerver/tests/test_auth_backends.py', 'zerver/tests/test_narrow.py', 'zerver/tests/test_tornado.py', 'zerver/tests/test_urls.py', diff --git a/zerver/tests/test_auth_backends.py b/zerver/tests/test_auth_backends.py index c61cfdb353..199762e3eb 100644 --- a/zerver/tests/test_auth_backends.py +++ b/zerver/tests/test_auth_backends.py @@ -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):