Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ include README.rst
include CODE_OF_CONDUCT.md

global-exclude *.py[cod] __pycache__/* *.so *.dylib
recursive-include rpm *.spec
67 changes: 67 additions & 0 deletions rpm/quads-lib.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#### 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

%define name quads-lib
%define reponame python-quads-lib
%define branch development
%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
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

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 %{reponame}-%{branch}

%build
%py3_build

%install
%py3_install

%clean
rm -rf %{buildroot}

%files
%doc README.rst CHANGELOG.rst
%license LICENSE
%{python3_sitelib}/quads_lib/
%{python3_sitelib}/quads_lib-*.egg-info/

%changelog

* Wed Apr 30 2026 Will Foster <wfoster@redhat.com>
- 0.1.9 release
- Initial RPM package for quads-lib
- Provides QuadsApi client for QUADS API v3
- Required dependency for quads-client TUI
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
3 changes: 2 additions & 1 deletion src/quads_lib/quads.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]")
Expand Down
4 changes: 2 additions & 2 deletions tests/test_quads.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
Loading