diff --git a/tests/test_ldap_backend.py b/tests/test_ldap_backend.py index e41a54e..9254a91 100644 --- a/tests/test_ldap_backend.py +++ b/tests/test_ldap_backend.py @@ -39,12 +39,12 @@ def test_authenticate_success(slapd, settings, django_user_model, caplog): User = django_user_model settings.LDAP_AUTH_SETTINGS[0]['principal_filter'] = 'uid={username}' backend = A2LdapKerberosBackend() - with caplog.atLevel(logging.INFO): + with caplog.at_level(logging.INFO): assert not backend.authenticate(principal='john.doe@ENTROUVERT.COM') is None user = User.objects.get() assert user.username == 'john.doe@ldap' assert user.email == 'john.doe@example.com' - assert not caplog.records() + assert not caplog.records def test_authenticate_principal_filter_with_realm(slapd, settings, django_user_model, caplog): @@ -53,12 +53,12 @@ def test_authenticate_principal_filter_with_realm(slapd, settings, django_user_m User = django_user_model settings.LDAP_AUTH_SETTINGS[0]['principal_filter'] = 'uid={username}@{realm}' backend = A2LdapKerberosBackend() - with caplog.atLevel(logging.INFO): + with caplog.at_level(logging.INFO): assert not backend.authenticate(principal='john.doe@ENTROUVERT.COM') is None user = User.objects.get() assert user.username == 'john.doe@ldap' assert user.email == 'john.doe@example.com' - assert not caplog.records() + assert not caplog.records def test_authenticate_bad_principal_filter(slapd, settings, django_user_model, caplog): @@ -67,10 +67,10 @@ def test_authenticate_bad_principal_filter(slapd, settings, django_user_model, c User = django_user_model settings.LDAP_AUTH_SETTINGS[0]['principal_filter'] = 'uid={user}' backend = A2LdapKerberosBackend() - with caplog.atLevel(logging.INFO): + with caplog.at_level(logging.INFO): assert backend.authenticate(principal='john.doe@ENTROUVERT.COM') is None - assert len(caplog.records()) == 1 - assert 'principal_filter does not' in caplog.text() + assert len(caplog.records) == 1 + assert 'principal_filter does not' in caplog.text def test_authenticate_limit_to_realm_failure(slapd, settings, django_user_model, caplog): @@ -80,9 +80,9 @@ def test_authenticate_limit_to_realm_failure(slapd, settings, django_user_model, settings.LDAP_AUTH_SETTINGS[0]['principal_filter'] = 'uid={username}' settings.LDAP_AUTH_SETTINGS[0]['limit_to_realm'] = True backend = A2LdapKerberosBackend() - with caplog.atLevel(logging.INFO): + with caplog.at_level(logging.INFO): assert backend.authenticate(principal='john.doe@ENTROUVERT.COM') is None - assert not caplog.records() + assert not caplog.records def test_authenticate_limit_to_realm_success(slapd, settings, django_user_model): @@ -104,7 +104,7 @@ def test_authenticate_limit_to_realm_success(slapd, settings, django_user_model, User = django_user_model settings.LDAP_AUTH_SETTINGS[0]['principal_filter'] = 'uid={username}' backend = A2LdapKerberosBackend() - with caplog.atLevel(logging.INFO): + with caplog.at_level(logging.INFO): assert backend.authenticate(principal='foo.bar@ENTROUVERT.COM') is None - assert len(caplog.records()) == 1 - assert 'principal foo.bar@ENTROUVERT.COM not found' in caplog.text() + assert len(caplog.records) == 1 + assert 'principal foo.bar@ENTROUVERT.COM not found' in caplog.text