Skip to content

Commit

Permalink
Merge pull request #254 from consideRatio/pr/next
Browse files Browse the repository at this point in the history
tests: avoid reuse of authenticator fixture between tests and add docstring
  • Loading branch information
consideRatio authored Sep 15, 2024
2 parents cf6d3ae + 0d9950d commit d4a2e61
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ldapauthenticator/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
8 changes: 6 additions & 2 deletions ldapauthenticator/tests/test_ldapauthenticator.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down Expand Up @@ -70,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):
Expand Down

0 comments on commit d4a2e61

Please sign in to comment.