diff --git a/rpm/quads-lib.spec b/rpm/quads-lib.spec index 095bbee..b9801bc 100644 --- a/rpm/quads-lib.spec +++ b/rpm/quads-lib.spec @@ -12,7 +12,7 @@ %define name quads-lib %define reponame python-quads-lib %define branch development -%define version 0.1.9 +%define version 0.1.10 %define build_timestamp %{lua: print(os.date("%Y%m%d"))} Summary: Python client library for interacting with the QUADS API diff --git a/setup.py b/setup.py index ef1813d..8d30111 100755 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ def read(*names, **kwargs): setup( name="quads-lib", - version="0.1.9", + version="0.1.10", license="LGPL-3.0-only", description="Python client library for interacting with the QUADS API", long_description="{}\n{}".format( diff --git a/src/quads_lib/quads.py b/src/quads_lib/quads.py index 931d814..e0179f8 100644 --- a/src/quads_lib/quads.py +++ b/src/quads_lib/quads.py @@ -91,7 +91,8 @@ def is_available(self, hostname: str, data: dict) -> bool: url_params = urlencode(data) endpoint = Path("available") / hostname json_response = self.get(f"{endpoint}?{url_params}") - return "true" in json_response + # Server returns {hostname: "True"} or {hostname: "False"} + return json_response.get(hostname) == "True" # Clouds @returns("List[Cloud]") diff --git a/tests/test_quads.py b/tests/test_quads.py index cea5671..4f16403 100644 --- a/tests/test_quads.py +++ b/tests/test_quads.py @@ -506,7 +506,7 @@ def test_is_available_true(self, mock_get): hostname = "test-host" query_data = {"start_date": "2024-03-20", "end_date": "2024-03-21"} mock_response = Mock() - mock_response.json.return_value = "true" + mock_response.json.return_value = {hostname: "True"} mock_get.return_value = mock_response result = self.api.is_available(hostname, query_data) @@ -526,7 +526,7 @@ def test_is_available_false(self, mock_get): hostname = "test-host" query_data = {"start_date": "2024-03-20", "end_date": "2024-03-21"} mock_response = Mock() - mock_response.json.return_value = "false" + mock_response.json.return_value = {hostname: "False"} mock_get.return_value = mock_response result = self.api.is_available(hostname, query_data)