diff --git a/nova/gateway.py b/nova/gateway.py index 46e9a96..63266e8 100644 --- a/nova/gateway.py +++ b/nova/gateway.py @@ -76,7 +76,7 @@ def __init__( ): if host is None: host = config("NOVA_API", default=INTERNAL_CLUSTER_NOVA_API) - + if username is None: username = config("NOVA_USERNAME", default=None) @@ -127,7 +127,7 @@ def __init__( async def close(self): return await self._api_client.close() - + @staticmethod def _host_with_prefix(host: str) -> str: """ @@ -140,11 +140,11 @@ def _host_with_prefix(host: str) -> str: if host.startswith("http") and not is_wabo_host: return host - + if host.startswith("http") and is_wabo_host: return host.replace("http://", "https://") - + if is_wabo_host: return f"https://{host}" - + return f"http://{host}" diff --git a/tests/test_gateway.py b/tests/test_gateway.py index fd38e6a..3c943c1 100644 --- a/tests/test_gateway.py +++ b/tests/test_gateway.py @@ -1,5 +1,3 @@ - - import pytest from nova.gateway import ApiGateway @@ -8,7 +6,7 @@ @pytest.mark.asyncio async def test_api_gateway_host(): """ - NOVA_API env does not provide any prefix, + NOVA_API env might not provide any prefix, thus ApiGateway should make sure to use the prefix depending on the environment. https://wandelbots.atlassian.net/browse/RPS-1208 @@ -28,4 +26,3 @@ async def test_api_gateway_host(): expected_host = "https://someinstance.wandelbots.io" gateway = ApiGateway(host="someinstance.wandelbots.io") assert gateway._host == expected_host -