Skip to content

Commit

Permalink
tests: adjust to use pytest.raises
Browse files Browse the repository at this point in the history
  • Loading branch information
consideRatio committed Sep 20, 2024
1 parent 660efa7 commit eeb134d
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions ldapauthenticator/tests/test_ldapauthenticator.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
https://github.com/rroemhild/docker-test-openldap?tab=readme-ov-file#ldap-structure
"""

import pytest
from ldap3.core.exceptions import LDAPSSLConfigurationError

from ..ldapauthenticator import TlsStrategy
Expand Down Expand Up @@ -200,13 +201,7 @@ async def test_ldap_tls_kwargs_config_passthrough(authenticator):
authenticator.tls_kwargs = {
"ca_certs_file": "does-not-exist-so-error-expected",
}
try:
with pytest.raises(LDAPSSLConfigurationError):
await authenticator.get_authenticated_user(
None, {"username": "leela", "password": "leela"}
)
except LDAPSSLConfigurationError:
pass
else:
raise ValueError(
"Expected configuring tls_kwargs.ca_certs_file to a non-existing file to raise an error"
)

0 comments on commit eeb134d

Please sign in to comment.