Files
python-sdk/tests/test_smoke.py
T
82df3bdcb3 feat(hanzoai): regenerate client from unified OpenAPI spec (retire Stainless) (#45)
Replace the Stainless-generated `hanzoai` client (188 legacy LLM-gateway
endpoints) with an openapi-generator `python` (urllib3 + pydantic v2)
client built from hanzoai/openapi `hanzo.yaml` — the full unified
api.hanzo.ai/v1 surface (493 API groups, 1710 models, all /v1 products).

- scripts/generate.sh: the one-way generator; emits only pkg/hanzoai
  (other pkg/hanzo-* packages untouched).
- pyproject: deps -> urllib3 / python-dateutil / pydantic>=2 /
  typing-extensions; version 2.2.3 -> 3.0.0 (breaking surface change).
- tests/: Stainless client tests replaced with a surface smoke test.
- .github/workflows/generate.yml: regenerate on openapi spec-update.
- Base URL https://api.hanzo.ai, Bearer hk- / JWT auth.

Verified: wheel hanzoai-3.0.0 builds, installs into a clean venv, and
`import hanzoai` + product API construction succeed.

Co-authored-by: Hanzo Dev <[email protected]>
2026-07-04 20:07:32 -07:00

37 lines
1.3 KiB
Python

"""Smoke tests for the generated `hanzoai` client.
The client is generated from hanzoai/openapi `hanzo.yaml` (openapi-generator,
urllib3). These assert the package imports and the unified api.hanzo.ai/v1
product surface is present — not network behaviour.
"""
import hanzoai
def test_client_constructs():
cfg = hanzoai.Configuration(host="https://api.hanzo.ai")
cfg.access_token = "hk-test"
client = hanzoai.ApiClient(cfg)
assert client is not None
assert cfg.host == "https://api.hanzo.ai"
def test_product_apis_present():
from hanzoai.api.tracker_projects_api import TrackerProjectsApi
from hanzoai.api.chat_agents_api import ChatAgentsApi
from hanzoai.api.crm_opportunities_api import CrmOpportunitiesApi
client = hanzoai.ApiClient(hanzoai.Configuration(host="https://api.hanzo.ai"))
for cls in (TrackerProjectsApi, ChatAgentsApi, CrmOpportunitiesApi):
assert cls(client) is not None
def test_full_surface_breadth():
import glob
import os
api_dir = os.path.dirname(hanzoai.api.__file__)
modules = glob.glob(os.path.join(api_dir, "*_api.py"))
# The full unified surface is hundreds of API groups, not the ~40 of the
# legacy LLM-gateway-only client.
assert len(modules) > 300, f"only {len(modules)} api modules — surface too small"