Skip to content

Commit 3ed3f65

Browse files
committed
Fix LDAPAuthenticator tests
1 parent 67ac8a2 commit 3ed3f65

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

tiled/_tests/test_authenticators.py

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

5151
asyncio.run(testing())
5252

53-
def test_ldap_validation():
54-
# single address, port can be none
53+
54+
def test_ldap_port_validation():
55+
# port can be none
5556
auth = LDAPAuthenticator(server_address="http://ldap.example.com", server_port=None)
5657
assert auth.server_port is not None
58+
59+
60+
def test_auth_server_list_wrapping():
61+
auth = LDAPAuthenticator(server_address="http://ldap.example.com", server_port=None)
5762
assert auth.server_address_list == ["http://ldap.example.com"]
5863

59-
# list of addresses aren't nested into extra list
64+
65+
def test_list_of_addresses_not_nested_into_extra_list():
6066
auth = LDAPAuthenticator(server_address=["http://ldap.example.com"])
6167
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)