ldap: additional tests for the keep_password function (#50931)
License: MIT
This commit is contained in:
parent
882ce5d930
commit
cc02a30b14
|
@ -251,6 +251,25 @@ def test_keep_password_in_session(slapd, settings, client, db):
|
|||
force_bytes(result.context['request'].user.ldap_data['password'][DN.lower()])) == force_bytes(PASS)
|
||||
|
||||
|
||||
def test_keep_password_true_or_false(slapd, settings, db):
|
||||
settings.LDAP_AUTH_SETTINGS = [{
|
||||
'url': [slapd.ldap_url],
|
||||
'basedn': u'o=ôrga',
|
||||
'use_tls': False,
|
||||
'keep_password': True,
|
||||
}]
|
||||
user = authenticate(username=USERNAME, password=PASS)
|
||||
assert User.objects.count() == 1
|
||||
user = User.objects.get()
|
||||
assert user.check_password(PASS)
|
||||
|
||||
settings.LDAP_AUTH_SETTINGS[0]['keep_password'] = False
|
||||
user = ldap_backend.LDAPBackend().authenticate(username=USERNAME, password=PASS)
|
||||
assert User.objects.count() == 1
|
||||
user = User.objects.get()
|
||||
assert not user.check_password(PASS)
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_custom_ou(slapd, settings, client):
|
||||
OU = get_ou_model()
|
||||
|
|
Loading…
Reference in New Issue