mirror of https://github.com/zulip/zulip.git
test_settings: Verify logs of domain mismatch in password change test.
Use assertLogs for verifying debug log produced due to LDAP domain mismatch while changing password. This will avoid spam in test-backend output.
This commit is contained in:
parent
dbbacdd3d9
commit
1668c7395e
|
@ -285,7 +285,8 @@ class ChangeSettingsTest(ZulipTestCase):
|
||||||
self.assert_json_error(result, "Your Zulip password is managed in LDAP")
|
self.assert_json_error(result, "Your Zulip password is managed in LDAP")
|
||||||
|
|
||||||
with self.settings(LDAP_APPEND_DOMAIN="example.com",
|
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(
|
result = self.client_patch(
|
||||||
"/json/settings",
|
"/json/settings",
|
||||||
dict(
|
dict(
|
||||||
|
@ -293,6 +294,9 @@ class ChangeSettingsTest(ZulipTestCase):
|
||||||
new_password="ignored",
|
new_password="ignored",
|
||||||
))
|
))
|
||||||
self.assert_json_success(result)
|
self.assert_json_success(result)
|
||||||
|
self.assertEqual(debug_log.output, [
|
||||||
|
'DEBUG:zulip.ldap:ZulipLDAPAuthBackend: Email hamlet@zulip.com does not match LDAP domain example.com.'
|
||||||
|
])
|
||||||
|
|
||||||
with self.settings(LDAP_APPEND_DOMAIN=None,
|
with self.settings(LDAP_APPEND_DOMAIN=None,
|
||||||
AUTH_LDAP_USER_ATTR_MAP=ldap_user_attr_map):
|
AUTH_LDAP_USER_ATTR_MAP=ldap_user_attr_map):
|
||||||
|
|
Loading…
Reference in New Issue