From ebb4f5bdf9c75870cae9b87fb1e9817150f9afd1 Mon Sep 17 00:00:00 2001 From: Amber Charitos Date: Wed, 29 May 2024 13:22:02 +0100 Subject: [PATCH] allow ldaps for ldap url --- src/structured_config.py | 2 +- tests/integration/test_policy.py | 3 +-- tests/unit/test_structured_config.py | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/structured_config.py b/src/structured_config.py index 5f04f4a..a482985 100644 --- a/src/structured_config.py +++ b/src/structured_config.py @@ -109,7 +109,7 @@ def sync_ldap_url_validator(cls, value: str) -> Optional[str]: Raises: ValueError: in the case when the value incorrectly formatted. """ - ldap_url_pattern = r"^ldap://.*:\d+$" + ldap_url_pattern = r"^ldaps?://.*:\d+$" if re.match(ldap_url_pattern, value) is not None: return value raise ValueError("Value incorrectly formatted.") diff --git a/tests/integration/test_policy.py b/tests/integration/test_policy.py index 17c44dd..5e7b71c 100644 --- a/tests/integration/test_policy.py +++ b/tests/integration/test_policy.py @@ -61,5 +61,4 @@ async def test_create_service(self, ops_test: OpsTest): new_service = ranger.get_service(TRINO_SERVICE) logger.info(f"service: {new_service}") name = new_service.get("name") - service_id = new_service.get("id") - assert name == TRINO_SERVICE and service_id == 1 + assert TRINO_SERVICE in name diff --git a/tests/unit/test_structured_config.py b/tests/unit/test_structured_config.py index 23cac66..808691c 100644 --- a/tests/unit/test_structured_config.py +++ b/tests/unit/test_structured_config.py @@ -45,7 +45,7 @@ def test_string_values(_harness) -> None: # sync-ldap-url check_invalid_values(_harness, "sync-ldap-url", erroneus_values) - accepted_values = ["ldap://ldap-k8s:3893", "ldap://example-host:636"] + accepted_values = ["ldap://ldap-k8s:3893", "ldaps://example-host:636"] check_valid_values(_harness, "sync-ldap-url", accepted_values)