Django 1.10: Suppress logs.

This commit is contained in:
Umair Khan
2016-11-07 16:48:27 +05:00
parent 1e91b946d9
commit ee3ec96f38

View File

@@ -985,6 +985,10 @@ class TestDevAuthBackend(ZulipTestCase):
data = {'direct_email': email}
with self.settings(AUTHENTICATION_BACKENDS=('zproject.backends.EmailAuthBackend',)):
with self.assertRaisesRegexp(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)
@@ -993,6 +997,10 @@ class TestDevAuthBackend(ZulipTestCase):
email = 'nonexisting@zulip.com'
data = {'direct_email': email}
with self.assertRaisesRegexp(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)