added info column

This commit is contained in:
2025-10-18 16:32:47 -04:00
parent 4e2527f75b
commit 4396c185b2
3 changed files with 41 additions and 12 deletions

View File

@@ -57,6 +57,7 @@ class LicenseServerClient:
*,
is_active: bool = True,
expiration_iso: Optional[str] = None,
info: Optional[str] = None,
auth: bool = True,
) -> requests.Response:
params = {}
@@ -64,6 +65,8 @@ class LicenseServerClient:
params["is_active"] = "false"
if expiration_iso is not None:
params["expiration_date"] = expiration_iso
if info is not None:
params["info"] = info
return self.request("post", "/license", params=params or None, auth=auth)
def is_valid(self, license_key: str) -> requests.Response:
@@ -131,11 +134,13 @@ def test_license_endpoint_requires_authentication(client: LicenseServerClient) -
def test_license_lifecycle_and_exports(client: LicenseServerClient) -> None:
create_response = client.create_license()
info_text = "QA test license"
create_response = client.create_license(info=info_text)
assert create_response.status_code == 201
created_payload = create_response.json()
license_key = created_payload["license_key"]
assert created_payload["is_active"] is True
assert created_payload["info"] == info_text
parts = license_key.split("-")
assert len(parts) == 5
assert all(len(part) == 5 for part in parts)
@@ -172,7 +177,9 @@ def test_license_lifecycle_and_exports(client: LicenseServerClient) -> None:
export_rows = list(csv.DictReader(export_response.text.splitlines()))
matching_rows = [row for row in export_rows if row["license_key"] == license_key]
assert matching_rows, "Created license key not found in export."
assert matching_rows[0]["is_active"] == "true"
exported_row = matching_rows[0]
assert exported_row["is_active"] == "true"
assert exported_row["info"] == info_text
history_response = client.export_history(token=license_key)
assert history_response.status_code == 200