Skip to content

Commit 67ac8a2

Browse files
committed
Update LDAPAuthenticator tests
1 parent 0b372a5 commit 67ac8a2

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

tiled/_tests/test_authenticators.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def test_LDAPAuthenticator_01(use_tls, use_ssl, ldap_server_address, ldap_server
3535
"""
3636

3737
authenticator = LDAPAuthenticator(
38-
server_address_list=[ldap_server_address],
38+
server_address=ldap_server_address,
3939
bind_dn_template="cn={username},ou=users,dc=example,dc=org",
4040
use_ssl=use_ssl,
4141
use_tls=use_tls,
@@ -49,3 +49,13 @@ async def testing():
4949
assert (await authenticator.authenticate("user02", "password2a")) is None
5050

5151
asyncio.run(testing())
52+
53+
def test_ldap_validation():
54+
# single address, port can be none
55+
auth = LDAPAuthenticator(server_address="http://ldap.example.com", server_port=None)
56+
assert auth.server_port is not None
57+
assert auth.server_address_list == ["http://ldap.example.com"]
58+
59+
# list of addresses aren't nested into extra list
60+
auth = LDAPAuthenticator(server_address=["http://ldap.example.com"])
61+
assert auth.server_address_list == ["http://ldap.example.com"]

0 commit comments

Comments
 (0)