Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

test_auth_backends: Remove mock.patch('logging.warning').

palash8393f64120e0
diff --git a/zerver/tests/test_auth_backends.py b/zerver/tests/test_auth_backends.py
index 3f01d7a7293..e12b0c1a08a 100644
--- a/zerver/tests/test_auth_backends.py
+++ b/zerver/tests/test_auth_backends.py
@@ -3966,8 +3966,7 @@ class TestJWTLogin(ZulipTestCase):
def test_login_failure_due_to_wrong_subdomain(self) -> None:
payload = {'user': 'hamlet', 'realm': 'zulip.com'}
with self.settings(JWT_AUTH_KEYS={'acme': {'key': 'key', 'algorithms': ['HS256']}}):
- with mock.patch('zerver.views.auth.get_subdomain', return_value='acme'), \
- mock.patch('logging.warning'):
+ with mock.patch('zerver.views.auth.get_subdomain', return_value='acme'):
key = settings.JWT_AUTH_KEYS['acme']['key']
[algorithm] = settings.JWT_AUTH_KEYS['acme']['algorithms']
web_token = jwt.encode(payload, key, algorithm).decode('utf8')
@@ -3980,8 +3979,7 @@ class TestJWTLogin(ZulipTestCase):
def test_login_failure_due_to_empty_subdomain(self) -> None:
payload = {'user': 'hamlet', 'realm': 'zulip.com'}
with self.settings(JWT_AUTH_KEYS={'': {'key': 'key', 'algorithms': ['HS256']}}):
- with mock.patch('zerver.views.auth.get_subdomain', return_value=''), \
- mock.patch('logging.warning'):
+ with mock.patch('zerver.views.auth.get_subdomain', return_value=''):
key = settings.JWT_AUTH_KEYS['']['key']
[algorithm] = settings.JWT_AUTH_KEYS['']['algorithms']
web_token = jwt.encode(payload, key, algorithm).decode('utf8')