diff --git a/octavia-cli/octavia_cli/api_http_headers.py b/octavia-cli/octavia_cli/api_http_headers.py index f17ab42dcdb61..df236ae33a8cf 100644 --- a/octavia-cli/octavia_cli/api_http_headers.py +++ b/octavia-cli/octavia_cli/api_http_headers.py @@ -23,11 +23,9 @@ class ApiHttpHeader: value: str def __post_init__(self): - self.name = str(self.name) - self.value = str(self.value) try: - assert len(self.name) > 0 - assert len(self.value) > 0 + assert isinstance(self.name, str) and self.name + assert isinstance(self.value, str) and self.value except AssertionError: raise AttributeError("Header name and value must be non empty string.") self.name = self.name.strip() diff --git a/octavia-cli/unit_tests/test_entrypoint.py b/octavia-cli/unit_tests/test_entrypoint.py index 527e0de6c9377..c1af732a38936 100644 --- a/octavia-cli/unit_tests/test_entrypoint.py +++ b/octavia-cli/unit_tests/test_entrypoint.py @@ -172,6 +172,7 @@ def test_octavia_not_initialized(mocker): ) def test_get_api_client(mocker, api_http_headers: Optional[List[str]]): mocker.patch.object(entrypoint, "airbyte_api_client") + entrypoint.airbyte_api_client.Configuration.return_value.get_basic_auth_token.return_value = "my_basic_auth_token" mocker.patch.object(entrypoint, "check_api_health") mocker.patch.object(entrypoint, "set_api_headers_on_api_client") api_client = entrypoint.get_api_client("test-url", "test-username", "test-password", "test-user-agent", api_http_headers)