diff --git a/mapping_provider/backends/services.py b/mapping_provider/backends/services.py index b07a896f50ecb819d681a325f04b1fa4da4ff70e..7406a0ebb29dbc150a2fd2297eb978aa22cd1a22 100644 --- a/mapping_provider/backends/services.py +++ b/mapping_provider/backends/services.py @@ -1,4 +1,3 @@ -import functools import logging import re from collections.abc import Generator @@ -54,7 +53,9 @@ def endpoint_equipment(endpoint: dict[str, Any]) -> str: if 'hostname' in endpoint: return _hostname_to_equipment(endpoint['hostname']) elif 'equipment' in endpoint: - return endpoint['equipment'] + _name = endpoint['equipment'] + assert isinstance(_name, str) # mypy noise + return _name # should already be validated raise AssertionError(f'no equipment or hostname in endpoint: {endpoint}') diff --git a/test/test_map_endpoints.py b/test/test_map_endpoints.py index 113fa37d7c8d2ecf902dc2b056b7b2214af24eea..c3dbaba94c42eed1fdaf0c348f7aa657bda64b87 100644 --- a/test/test_map_endpoints.py +++ b/test/test_map_endpoints.py @@ -76,7 +76,7 @@ def test_get_services(client, service_type): def test_get_unknown_service_type(client): - rv = client.get(f"/map/services/BOGUS_SERVICE_TYPE") + rv = client.get("/map/services/BOGUS_SERVICE_TYPE") assert rv.status_code == 404