Skip to content

Commit be9f4a9

Browse files
committed
Fix LDAPAuthenticator tests
1 parent 67ac8a2 commit be9f4a9

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

tiled/_tests/test_authenticators.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,15 @@ async def testing():
5050

5151
asyncio.run(testing())
5252

53-
def test_ldap_validation():
54-
# single address, port can be none
53+
def test_ldap_port_validation():
54+
# port can be none
5555
auth = LDAPAuthenticator(server_address="http://ldap.example.com", server_port=None)
5656
assert auth.server_port is not None
57+
58+
def test_auth_server_list_wrapping():
59+
auth = LDAPAuthenticator(server_address="http://ldap.example.com", server_port=None)
5760
assert auth.server_address_list == ["http://ldap.example.com"]
5861

59-
# list of addresses aren't nested into extra list
62+
def test_list_of_addresses_not_nested_into_extra_list():
6063
auth = LDAPAuthenticator(server_address=["http://ldap.example.com"])
6164
assert auth.server_address_list == ["http://ldap.example.com"]

tiled/authenticators.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ class LDAPAuthenticator(InternalAuthenticator):
507507
def ignore_nones(cls, data: Any) -> Any:
508508
if isinstance(data, dict):
509509
if data.get("server_port") is None:
510-
data.pop("server_port")
510+
data.pop("server_port", None)
511511
return data
512512

513513
async def resolve_username(self, username_supplied_by_user):

0 commit comments

Comments
 (0)