From d0eaf1c89f463c40f3c96a92b2c3afc351d66be0 Mon Sep 17 00:00:00 2001 From: Erik Sundell Date: Sat, 14 Sep 2024 19:43:13 +0200 Subject: [PATCH 1/2] tests: update file's docstring with info about test data --- ldapauthenticator/tests/test_ldapauthenticator.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ldapauthenticator/tests/test_ldapauthenticator.py b/ldapauthenticator/tests/test_ldapauthenticator.py index 7ea23e7..c94a453 100644 --- a/ldapauthenticator/tests/test_ldapauthenticator.py +++ b/ldapauthenticator/tests/test_ldapauthenticator.py @@ -1,4 +1,9 @@ -# Inspired by https://github.com/jupyterhub/jupyterhub/blob/main/jupyterhub/tests/test_auth.py +""" +Inspired by https://github.com/jupyterhub/jupyterhub/blob/main/jupyterhub/tests/test_auth.py + +Testing data is hardcoded in docker-test-openldap, described at +https://github.com/rroemhild/docker-test-openldap?tab=readme-ov-file#ldap-structure +""" async def test_ldap_auth_allowed(authenticator): From 0d9950d23f47e31fc2e0d3d0bf8275b12257fd14 Mon Sep 17 00:00:00 2001 From: Erik Sundell Date: Sat, 14 Sep 2024 19:44:05 +0200 Subject: [PATCH 2/2] tests: avoid reuse of authenticator fixture between tests --- ldapauthenticator/tests/conftest.py | 2 +- ldapauthenticator/tests/test_ldapauthenticator.py | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/ldapauthenticator/tests/conftest.py b/ldapauthenticator/tests/conftest.py index 3dbc48a..5204a35 100644 --- a/ldapauthenticator/tests/conftest.py +++ b/ldapauthenticator/tests/conftest.py @@ -5,7 +5,7 @@ from ..ldapauthenticator import LDAPAuthenticator -@pytest.fixture(scope="session") +@pytest.fixture() def authenticator(): authenticator = LDAPAuthenticator() authenticator.server_address = os.environ.get("LDAP_HOST", "localhost") diff --git a/ldapauthenticator/tests/test_ldapauthenticator.py b/ldapauthenticator/tests/test_ldapauthenticator.py index c94a453..dc15b75 100644 --- a/ldapauthenticator/tests/test_ldapauthenticator.py +++ b/ldapauthenticator/tests/test_ldapauthenticator.py @@ -75,7 +75,6 @@ async def test_ldap_auth_use_lookup_dn(authenticator): None, {"username": "fry", "password": "fry"} ) assert authorized["name"] == "philip j. fry" - authenticator.use_lookup_dn_username = False async def test_ldap_auth_search_filter(authenticator):