mirror of
https://github.com/zulip/zulip.git
synced 2025-11-05 06:23:38 +00:00
Django 1.10: Suppress logs.
This commit is contained in:
@@ -985,6 +985,10 @@ 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.assertRaisesRegexp(Exception, 'Direct login not supported.'):
|
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'):
|
with mock.patch('django.core.handlers.base.logger'):
|
||||||
self.client_post('/accounts/login/local/', data)
|
self.client_post('/accounts/login/local/', data)
|
||||||
|
|
||||||
@@ -993,6 +997,10 @@ class TestDevAuthBackend(ZulipTestCase):
|
|||||||
email = 'nonexisting@zulip.com'
|
email = 'nonexisting@zulip.com'
|
||||||
data = {'direct_email': email}
|
data = {'direct_email': email}
|
||||||
with self.assertRaisesRegexp(Exception, 'User cannot login'):
|
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'):
|
with mock.patch('django.core.handlers.base.logger'):
|
||||||
self.client_post('/accounts/login/local/', data)
|
self.client_post('/accounts/login/local/', data)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user