From f00fb16a7f450b3d8713596e6405637249cf80f9 Mon Sep 17 00:00:00 2001 From: Gonzalo Rafuls Date: Tue, 30 Dec 2025 10:51:27 -0300 Subject: [PATCH 01/11] CI: Modified release process --- .bumpversion.cfg | 2 +- .github/workflows/publish.yml | 33 ++------------------------------- CONTRIBUTING.rst | 10 ++++++++++ 3 files changed, 13 insertions(+), 32 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index b0b2f33..0028624 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -2,7 +2,7 @@ current_version = 0.1.8 commit = True tag = True -message = "Bump version: {current_version} → {new_version} [skip ci]" +message = "Bump version: {current_version} → {new_version} [publish]" [bumpversion:file:setup.py] search = version="{current_version}" diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index cee962a..01a0ecc 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -7,7 +7,7 @@ on: jobs: publish: - if: github.actor != 'github-actions[bot]' + if: github.actor != 'github-actions[bot]' && contains(github.event.head_commit.message, '[publish]') runs-on: ubuntu-latest permissions: @@ -28,40 +28,11 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install setuptools wheel twine bump2version - - - name: Configure Git - run: | - git config --global user.email "grafuls@gmail.com" - git config --global user.name "Your Name" - - - name: Bump version - run: | - # Keep bumping until we find a version without an existing tag - for i in {1..10}; do - NEW_VERSION=$(bump2version --dry-run --list patch | grep new_version | sed -r 's/^.*=//') - if git rev-parse "v${NEW_VERSION}" >/dev/null 2>&1; then - echo "Tag v${NEW_VERSION} already exists, bumping past it..." - bump2version patch --no-tag --no-commit --allow-dirty - else - echo "Bumping to v${NEW_VERSION}" - bump2version patch - break - fi - done + pip install setuptools wheel twine - name: Build package run: python setup.py sdist bdist_wheel - - name: Sync changes with all branches - run: | - git checkout latest - git pull origin latest --rebase - git push origin latest - git checkout development - git merge latest - git push origin development - - name: Publish package env: TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 3173008..e53f504 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -73,6 +73,16 @@ For merging, you should: 3. Add a note to ``CHANGELOG.rst`` about the changes. 4. Add yourself to ``AUTHORS.rst``. +Release Process +=============== + +To release a new version, run the following command:: + + bumpversion patch + +This will increment the version number and commit the changes. + + Tips ---- From 0cb9c3c33dacb78d06c065f5c97a8ac3b303e62c Mon Sep 17 00:00:00 2001 From: Gonzalo Rafuls Date: Tue, 30 Dec 2025 11:00:56 -0300 Subject: [PATCH 02/11] =?UTF-8?q?"Bump=20version:=200.1.8=20=E2=86=92=200.?= =?UTF-8?q?1.9=20[publish]"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .bumpversion.cfg | 2 +- docs/conf.py | 2 +- setup.py | 2 +- src/quads_lib/__init__.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 0028624..f82f2c5 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 0.1.8 +current_version = 0.1.9 commit = True tag = True message = "Bump version: {current_version} → {new_version} [publish]" diff --git a/docs/conf.py b/docs/conf.py index 3625d9a..924206a 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -15,7 +15,7 @@ year = "2025" author = "Gonzalo Rafuls" copyright = f"{year}, {author}" -version = release = "0.1.8" +version = release = "0.1.9" pygments_style = "trac" templates_path = ["."] diff --git a/setup.py b/setup.py index 000f906..ef1813d 100755 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ def read(*names, **kwargs): setup( name="quads-lib", - version="0.1.8", + version="0.1.9", 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/__init__.py b/src/quads_lib/__init__.py index 32d45c8..0526669 100644 --- a/src/quads_lib/__init__.py +++ b/src/quads_lib/__init__.py @@ -1,4 +1,4 @@ -__version__ = "0.1.8" +__version__ = "0.1.9" from .quads import QuadsApi From 7f45d0acff98b966b8acb6aa2333d821c472d545 Mon Sep 17 00:00:00 2001 From: Will Foster Date: Mon, 26 Jan 2026 12:18:48 +0000 Subject: [PATCH 03/11] feat: refactor for pep8, pyright, flake8. --- src/quads_lib/base.py | 3 ++- src/quads_lib/quads.py | 58 ++++++++++++++++++++++++++---------------- 2 files changed, 38 insertions(+), 23 deletions(-) diff --git a/src/quads_lib/base.py b/src/quads_lib/base.py index 0f6ae35..790b973 100644 --- a/src/quads_lib/base.py +++ b/src/quads_lib/base.py @@ -32,7 +32,8 @@ def __init__( password: Password for QUADS authentication base_url: Base URL for the QUADS API verify: Controls TLS certificate verification. Can be: - - False: Disable certificate verification (default, for backward compatibility) + - False: Disable certificate verification (default, for + backward compatibility) - True: Enable verification using default CA bundle - str: Path to a custom CA bundle file """ diff --git a/src/quads_lib/quads.py b/src/quads_lib/quads.py index 591801d..27f0c8a 100644 --- a/src/quads_lib/quads.py +++ b/src/quads_lib/quads.py @@ -1,8 +1,6 @@ from pathlib import Path from typing import Optional -from urllib import parse as url_parse -from urllib.parse import urlencode -from urllib.parse import urljoin +from urllib.parse import urlencode, urljoin from quads_lib.base import QuadsBase from quads_lib.decorators import returns @@ -15,16 +13,27 @@ class QuadsApi(QuadsBase): # Auth def register(self) -> dict: - json_response = self._make_request("POST", "register", {"email": self.username, "password": self.password}) + json_response = self._make_request( + "POST", + "register", + { + "email": self.username, + "password": self.password + }, + ) return json_response def login(self) -> dict: endpoint = urljoin(self.base_url, "login") - _response = self.session.post(endpoint, auth=self.auth, verify=self.verify) + _response = self.session.post( + endpoint, auth=self.auth, verify=self.verify + ) json_response = _response.json() if json_response.get("status_code") == 201: self.token = json_response.get("auth_token") - self.session.headers.update({"Authorization": f"Bearer {self.token}"}) + self.session.headers.update( + {"Authorization": f"Bearer {self.token}"} + ) return json_response def logout(self) -> dict: @@ -46,19 +55,19 @@ def get_host_models(self) -> dict: @returns("List[Host]") def filter_hosts(self, data: dict) -> dict: - url_params = url_parse.urlencode(data) + url_params = urlencode(data) json_response = self.get(f"hosts?{url_params}") return json_response @returns("List[Cloud]") def filter_clouds(self, data: dict) -> dict: - url_params = url_parse.urlencode(data) + url_params = urlencode(data) json_response = self.get(f"clouds?{url_params}") return json_response @returns("List[Assignment]") def filter_assignments(self, data: dict) -> dict: - url_params = url_parse.urlencode(data) + url_params = urlencode(data) json_response = self.get(f"assignments?{url_params}") return json_response @@ -85,10 +94,10 @@ def remove_host(self, hostname: str) -> dict: return json_response def is_available(self, hostname: str, data: dict) -> bool: - url_params = url_parse.urlencode(data) + url_params = urlencode(data) endpoint = Path("available") / hostname json_response = self.get(f"{endpoint}?{url_params}") - return True if "true" in json_response else False + return "true" in json_response # Clouds @returns("List[Cloud]") @@ -107,7 +116,7 @@ def get_cloud(self, cloud_name: str) -> dict: return json_response def get_summary(self, data: dict) -> dict: - url_params = url_parse.urlencode(data) + url_params = urlencode(data) endpoint = Path("clouds") / "summary" url = f"{endpoint}" if data: @@ -135,7 +144,7 @@ def remove_cloud(self, cloud_name: str) -> dict: def get_schedules(self, data: Optional[dict] = None) -> dict: if data is None: data = {} - url_params = url_parse.urlencode(data) + url_params = urlencode(data) url = "schedules" if url_params: url = f"{url}?{url_params}" @@ -149,7 +158,7 @@ def get_current_schedules(self, data: Optional[dict] = None) -> dict: endpoint = Path("schedules") / "current" url = f"{endpoint}" if data: - url_params = url_parse.urlencode(data) + url_params = urlencode(data) url = f"{endpoint}?{url_params}" json_response = self.get(url) return json_response @@ -164,7 +173,7 @@ def get_schedule(self, schedule_id: int) -> dict: def get_future_schedules(self, data: Optional[dict] = None) -> dict: if data is None: data = {} - url_params = url_parse.urlencode(data) + url_params = urlencode(data) endpoint = Path("schedules") / "future" url = f"{endpoint}" if data: @@ -203,7 +212,10 @@ def filter_available(self, data: dict) -> dict: def create_assignment(self, data: dict) -> dict: response = self.post("assignments", data) if response and {"id", "cloud"} <= response.keys(): - print(f"Assignment created - ID: {response['id']}, Cloud: {response['cloud']['name']}") + print( + f"Assignment created - ID: {response['id']}, " + f"Cloud: {response['cloud']['name']}" + ) return response @returns("Assignment") @@ -211,7 +223,10 @@ def create_self_assignment(self, data: dict) -> dict: endpoint = Path("assignments") / "self" response = self.post(str(endpoint), data) if response and {"id", "cloud"} <= response.keys(): - print(f"Self-assignment created - ID: {response['id']}, Cloud: {response['cloud']['name']}") + print( + f"Self-assignment created - ID: {response['id']}, " + f"Cloud: {response['cloud']['name']}" + ) return response @returns("Assignment") @@ -279,7 +294,7 @@ def create_memory(self, hostname: str, data: dict) -> dict: return json_response def remove_memory(self, memory_id: int) -> dict: - endpoint = Path("memory") / memory_id + endpoint = Path("memory") / str(memory_id) json_response = self.delete(str(endpoint)) return json_response @@ -297,7 +312,7 @@ def update_disk(self, hostname: str, data: dict) -> dict: return json_response def remove_disk(self, hostname: str, disk_id: int) -> dict: - endpoint = Path("disks") / hostname / disk_id + endpoint = Path("disks") / hostname / str(disk_id) json_response = self.delete(str(endpoint)) return json_response @@ -309,11 +324,10 @@ def create_processor(self, hostname: str, data: dict) -> dict: return json_response def remove_processor(self, processor_id: int) -> dict: - endpoint = Path("processors") / processor_id + endpoint = Path("processors") / str(processor_id) json_response = self.delete(str(endpoint)) return json_response - # Vlans @returns("List[Vlan]") def get_vlans(self) -> dict: json_response = self.get("vlans") @@ -345,7 +359,7 @@ def create_vlan(self, data: dict) -> dict: def get_moves(self, date: Optional[str] = None) -> dict: url = "moves" if date: - url_params = url_parse.urlencode({"date": date}) + url_params = urlencode({"date": date}) url = f"moves?{url_params}" json_response = self.get(url) return json_response From f77b970c8506345a0a9056f27c48511fa5f4a1ab Mon Sep 17 00:00:00 2001 From: Will Foster Date: Mon, 26 Jan 2026 12:28:04 +0000 Subject: [PATCH 04/11] fix ruff complaints --- src/quads_lib/quads.py | 38 ++++++++------------------------------ 1 file changed, 8 insertions(+), 30 deletions(-) diff --git a/src/quads_lib/quads.py b/src/quads_lib/quads.py index 27f0c8a..9ee1242 100644 --- a/src/quads_lib/quads.py +++ b/src/quads_lib/quads.py @@ -1,6 +1,7 @@ from pathlib import Path from typing import Optional -from urllib.parse import urlencode, urljoin +from urllib.parse import urlencode +from urllib.parse import urljoin from quads_lib.base import QuadsBase from quads_lib.decorators import returns @@ -16,24 +17,17 @@ def register(self) -> dict: json_response = self._make_request( "POST", "register", - { - "email": self.username, - "password": self.password - }, + {"email": self.username, "password": self.password}, ) return json_response def login(self) -> dict: endpoint = urljoin(self.base_url, "login") - _response = self.session.post( - endpoint, auth=self.auth, verify=self.verify - ) + _response = self.session.post(endpoint, auth=self.auth, verify=self.verify) json_response = _response.json() if json_response.get("status_code") == 201: self.token = json_response.get("auth_token") - self.session.headers.update( - {"Authorization": f"Bearer {self.token}"} - ) + self.session.headers.update({"Authorization": f"Bearer {self.token}"}) return json_response def logout(self) -> dict: @@ -212,10 +206,7 @@ def filter_available(self, data: dict) -> dict: def create_assignment(self, data: dict) -> dict: response = self.post("assignments", data) if response and {"id", "cloud"} <= response.keys(): - print( - f"Assignment created - ID: {response['id']}, " - f"Cloud: {response['cloud']['name']}" - ) + print(f"Assignment created - ID: {response['id']}, Cloud: {response['cloud']['name']}") return response @returns("Assignment") @@ -223,10 +214,7 @@ def create_self_assignment(self, data: dict) -> dict: endpoint = Path("assignments") / "self" response = self.post(str(endpoint), data) if response and {"id", "cloud"} <= response.keys(): - print( - f"Self-assignment created - ID: {response['id']}, " - f"Cloud: {response['cloud']['name']}" - ) + print(f"Self-assignment created - ID: {response['id']}, Cloud: {response['cloud']['name']}") return response @returns("Assignment") @@ -356,14 +344,4 @@ def create_vlan(self, data: dict) -> dict: return self.post("vlans", data) # Moves - def get_moves(self, date: Optional[str] = None) -> dict: - url = "moves" - if date: - url_params = urlencode({"date": date}) - url = f"moves?{url_params}" - json_response = self.get(url) - return json_response - - def get_version(self) -> dict: - json_response = self.get("version") - return json_response + def get_moves(self From 15d1303e883a4217e0edf7b9404ff9ec15219be5 Mon Sep 17 00:00:00 2001 From: Will Foster Date: Mon, 26 Jan 2026 12:32:16 +0000 Subject: [PATCH 05/11] fix truncation issue --- src/quads_lib/quads.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/quads_lib/quads.py b/src/quads_lib/quads.py index 9ee1242..931d814 100644 --- a/src/quads_lib/quads.py +++ b/src/quads_lib/quads.py @@ -344,4 +344,14 @@ def create_vlan(self, data: dict) -> dict: return self.post("vlans", data) # Moves - def get_moves(self + def get_moves(self, date: Optional[str] = None) -> dict: + url = "moves" + if date: + url_params = urlencode({"date": date}) + url = f"moves?{url_params}" + json_response = self.get(url) + return json_response + + def get_version(self) -> dict: + json_response = self.get("version") + return json_response From f2fc655372fb91845ea574f8c35e9a952d5950b6 Mon Sep 17 00:00:00 2001 From: Will Foster Date: Thu, 30 Apr 2026 16:10:58 +0100 Subject: [PATCH 06/11] add RPM spec file --- rpm/quads-lib.spec | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 rpm/quads-lib.spec diff --git a/rpm/quads-lib.spec b/rpm/quads-lib.spec new file mode 100644 index 0000000..1bb0706 --- /dev/null +++ b/rpm/quads-lib.spec @@ -0,0 +1,40 @@ +Name: quads-lib +Version: 0.1.9 +Release: 1%{?dist} +Summary: Python client library for interacting with the QUADS API + +License: LGPL-3.0-only +URL: https://github.com/quadsproject/python-quads-lib +Source0: %{name}-%{version}.tar.gz + +BuildArch: noarch +BuildRequires: python3-devel +BuildRequires: python3-setuptools + +Requires: python3-requests >= 2.31.0 + +%description +Python client library for interacting with the QUADS (Automated Scheduling +and Delivery System) API. Provides QuadsApi class for REST API communication +with QUADS servers. + +%prep +%autosetup -n quads_lib-%{version} + +%build +%py3_build + +%install +%py3_install + +%files +%license LICENSE +%doc README.rst CHANGELOG.rst +%{python3_sitelib}/quads_lib/ +%{python3_sitelib}/quads_lib-*.egg-info/ + +%changelog +* Wed Apr 30 2026 Will Foster - 0.1.9-1 +- Initial RPM package for quads-lib +- Provides QuadsApi client for QUADS API v3 +- Required dependency for quads-client TUI From 3b82284aece6c93f0b4c31b0f003bd0388250246 Mon Sep 17 00:00:00 2001 From: Will Foster Date: Thu, 30 Apr 2026 16:14:56 +0100 Subject: [PATCH 07/11] chore: manifest update --- MANIFEST.in | 1 + 1 file changed, 1 insertion(+) diff --git a/MANIFEST.in b/MANIFEST.in index 55726d6..2a52251 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -22,3 +22,4 @@ include README.rst include CODE_OF_CONDUCT.md global-exclude *.py[cod] __pycache__/* *.so *.dylib +recursive-include rpm *.spec From ad82c745148544c5c0b77ed8c3d65e81a8443a74 Mon Sep 17 00:00:00 2001 From: Will Foster Date: Thu, 30 Apr 2026 16:26:25 +0100 Subject: [PATCH 08/11] chore: fix rpm spec file --- rpm/quads-lib.spec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rpm/quads-lib.spec b/rpm/quads-lib.spec index 1bb0706..c09a792 100644 --- a/rpm/quads-lib.spec +++ b/rpm/quads-lib.spec @@ -4,8 +4,8 @@ Release: 1%{?dist} Summary: Python client library for interacting with the QUADS API License: LGPL-3.0-only -URL: https://github.com/quadsproject/python-quads-lib -Source0: %{name}-%{version}.tar.gz +URL: https://quads.dev +Source0: https://github.com/quadsproject/python-quads-lib/archive/%{branch}.tar.gz#/%{name}-%{version}-%{release}.tar.gz BuildArch: noarch BuildRequires: python3-devel From 4e37cd1f025537ec74c0ef21f2ec7e3f7edaf953 Mon Sep 17 00:00:00 2001 From: Will Foster Date: Thu, 30 Apr 2026 16:38:39 +0100 Subject: [PATCH 09/11] chore: make rpm spec more copr-like --- rpm/quads-lib.spec | 55 ++++++++++++++++++++++++++++++++++------------ 1 file changed, 41 insertions(+), 14 deletions(-) diff --git a/rpm/quads-lib.spec b/rpm/quads-lib.spec index c09a792..095bbee 100644 --- a/rpm/quads-lib.spec +++ b/rpm/quads-lib.spec @@ -1,25 +1,47 @@ -Name: quads-lib -Version: 0.1.9 -Release: 1%{?dist} -Summary: Python client library for interacting with the QUADS API +#### NOTE: if building locally you may need to do the following: +#### +#### yum install rpmdevtools -y +#### spectool -g -R rpm/quads-lib.spec +#### +#### At this point you can use rpmbuild -ba quads-lib.spec +#### this is because our Source0 is a remote Github location +#### +#### Our upstream repository is located here: +#### https://copr.fedorainfracloud.org/coprs/quadsdev/QUADS -License: LGPL-3.0-only -URL: https://quads.dev -Source0: https://github.com/quadsproject/python-quads-lib/archive/%{branch}.tar.gz#/%{name}-%{version}-%{release}.tar.gz +%define name quads-lib +%define reponame python-quads-lib +%define branch development +%define version 0.1.9 +%define build_timestamp %{lua: print(os.date("%Y%m%d"))} -BuildArch: noarch -BuildRequires: python3-devel -BuildRequires: python3-setuptools +Summary: Python client library for interacting with the QUADS API +Name: %{name} +Version: %{version} +Release: %{build_timestamp} +Source0: https://github.com/quadsproject/%{reponame}/archive/%{branch}.tar.gz#/%{name}-%{version}-%{release}.tar.gz +License: LGPL-3.0-only +BuildRoot: %{_tmppath}/%{name}-buildroot +BuildArch: noarch +Vendor: QUADS Project +Packager: QUADS Project +BuildRequires: python3-devel +BuildRequires: python3-setuptools +Requires: python3 >= 3.9 +Requires: python3-requests >= 2.31.0 -Requires: python3-requests >= 2.31.0 +AutoReq: no + +Url: https://quads.dev %description + Python client library for interacting with the QUADS (Automated Scheduling and Delivery System) API. Provides QuadsApi class for REST API communication with QUADS servers. %prep -%autosetup -n quads_lib-%{version} +%autosetup -n %{reponame}-%{branch} %build %py3_build @@ -27,14 +49,19 @@ with QUADS servers. %install %py3_install +%clean +rm -rf %{buildroot} + %files -%license LICENSE %doc README.rst CHANGELOG.rst +%license LICENSE %{python3_sitelib}/quads_lib/ %{python3_sitelib}/quads_lib-*.egg-info/ %changelog -* Wed Apr 30 2026 Will Foster - 0.1.9-1 + +* Wed Apr 30 2026 Will Foster +- 0.1.9 release - Initial RPM package for quads-lib - Provides QuadsApi client for QUADS API v3 - Required dependency for quads-client TUI From 3153ae08f626c6ab12264107ec3cd908b287561f Mon Sep 17 00:00:00 2001 From: Will Foster Date: Thu, 7 May 2026 15:51:12 +0100 Subject: [PATCH 10/11] fix: json_response for is_available not returning hostname key. --- rpm/quads-lib.spec | 2 +- setup.py | 2 +- src/quads_lib/quads.py | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) 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]") From 6c763ca219e7ffb62e4a15a6af2195d6bb8d4ed0 Mon Sep 17 00:00:00 2001 From: Will Foster Date: Thu, 7 May 2026 16:01:24 +0100 Subject: [PATCH 11/11] chore: fix tests --- tests/test_quads.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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)