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_settings: Verify logs of domain mismatch in password change test.

Mohit Gupta1668c7395ef7
diff --git a/zerver/tests/test_settings.py b/zerver/tests/test_settings.py
index 9626c5104f7..0ae4090c8c1 100644
--- a/zerver/tests/test_settings.py
+++ b/zerver/tests/test_settings.py
@@ -285,7 +285,8 @@ class ChangeSettingsTest(ZulipTestCase):
self.assert_json_error(result, "Your Zulip password is managed in LDAP")
with self.settings(LDAP_APPEND_DOMAIN="example.com",
- AUTH_LDAP_USER_ATTR_MAP=ldap_user_attr_map):
+ AUTH_LDAP_USER_ATTR_MAP=ldap_user_attr_map), \
+ self.assertLogs('zulip.ldap', 'DEBUG') as debug_log:
result = self.client_patch(
"/json/settings",
dict(
@@ -293,6 +294,9 @@ class ChangeSettingsTest(ZulipTestCase):
new_password="ignored",
))
self.assert_json_success(result)
+ self.assertEqual(debug_log.output, [
+ 'DEBUG:zulip.ldap:ZulipLDAPAuthBackend: Email [email protected] does not match LDAP domain example.com.'
+ ])
with self.settings(LDAP_APPEND_DOMAIN=None,
AUTH_LDAP_USER_ATTR_MAP=ldap_user_attr_map):