mirror of https://github.com/zulip/zulip.git
GoogleSubdomainLoginTest: Suppress unnecessary logging output.
This helps make our test output nice and clean.
This commit is contained in:
parent
e5df05fd35
commit
d80d15c08d
|
@ -844,7 +844,9 @@ class GoogleSubdomainLoginTest(GoogleOAuthTest):
|
||||||
'email': self.example_email("hamlet"),
|
'email': self.example_email("hamlet"),
|
||||||
'subdomain': 'zulip',
|
'subdomain': 'zulip',
|
||||||
'is_signup': False}
|
'is_signup': False}
|
||||||
|
with mock.patch('logging.warning') as mock_warning:
|
||||||
result = self.get_log_into_subdomain(data, key='nonsense')
|
result = self.get_log_into_subdomain(data, key='nonsense')
|
||||||
|
mock_warning.assert_called_with("Subdomain cookie: Bad signature.")
|
||||||
self.assertEqual(result.status_code, 400)
|
self.assertEqual(result.status_code, 400)
|
||||||
|
|
||||||
def test_log_into_subdomain_when_signature_is_expired(self):
|
def test_log_into_subdomain_when_signature_is_expired(self):
|
||||||
|
@ -856,7 +858,9 @@ class GoogleSubdomainLoginTest(GoogleOAuthTest):
|
||||||
with mock.patch('django.core.signing.time.time', return_value=time.time() - 45):
|
with mock.patch('django.core.signing.time.time', return_value=time.time() - 45):
|
||||||
token = signing.dumps(data, salt=_subdomain_token_salt)
|
token = signing.dumps(data, salt=_subdomain_token_salt)
|
||||||
url_path = reverse('zerver.views.auth.log_into_subdomain', args=[token])
|
url_path = reverse('zerver.views.auth.log_into_subdomain', args=[token])
|
||||||
|
with mock.patch('logging.warning') as mock_warning:
|
||||||
result = self.client_get(url_path, subdomain='zulip')
|
result = self.client_get(url_path, subdomain='zulip')
|
||||||
|
mock_warning.assert_called_once()
|
||||||
self.assertEqual(result.status_code, 400)
|
self.assertEqual(result.status_code, 400)
|
||||||
|
|
||||||
def test_log_into_subdomain_when_is_signup_is_true(self):
|
def test_log_into_subdomain_when_is_signup_is_true(self):
|
||||||
|
@ -1000,7 +1004,9 @@ class GoogleSubdomainLoginTest(GoogleOAuthTest):
|
||||||
data = {'name': 'Full Name',
|
data = {'name': 'Full Name',
|
||||||
'email': self.example_email("hamlet"),
|
'email': self.example_email("hamlet"),
|
||||||
'subdomain': 'zephyr'}
|
'subdomain': 'zephyr'}
|
||||||
|
with mock.patch('logging.warning') as mock_warning:
|
||||||
result = self.get_log_into_subdomain(data)
|
result = self.get_log_into_subdomain(data)
|
||||||
|
mock_warning.assert_called_with("Login attempt on invalid subdomain")
|
||||||
self.assertEqual(result.status_code, 400)
|
self.assertEqual(result.status_code, 400)
|
||||||
|
|
||||||
def test_google_oauth2_registration(self):
|
def test_google_oauth2_registration(self):
|
||||||
|
|
Loading…
Reference in New Issue