From 6d9f69c07cfa04c8ff69b0ed30509ee35ceb4962 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 12 Jun 2026 20:10:26 +0000 Subject: [PATCH] chore(sdk): regenerate from archastro-openapi@main (generator 0.5.0) --- package-lock.json | 12 +- src/archastro/platform/__init__.py | 11 +- src/archastro/platform/auth.py | 175 +- src/archastro/platform/client.py | 266 +- src/archastro/platform/v1/__init__.py | 124 +- .../platform/v1/resources/__init__.py | 177 +- .../platform/v1/resources/activity_feed.py | 48 +- .../platform/v1/resources/agent_computers.py | 27 +- .../platform/v1/resources/agent_env_vars.py | 20 +- .../v1/resources/agent_health_actions.py | 20 +- .../v1/resources/agent_installations.py | 66 +- .../v1/resources/agent_routine_runs.py | 33 +- .../platform/v1/resources/agent_routines.py | 79 +- .../platform/v1/resources/agent_sessions.py | 59 +- .../platform/v1/resources/agent_skills.py | 35 +- .../platform/v1/resources/agent_tools.py | 37 +- src/archastro/platform/v1/resources/agents.py | 215 +- src/archastro/platform/v1/resources/ai.py | 42 +- .../platform/v1/resources/artifacts.py | 29 +- .../platform/v1/resources/automation_runs.py | 20 +- .../platform/v1/resources/automations.py | 18 +- .../platform/v1/resources/bug_reports.py | 14 +- src/archastro/platform/v1/resources/config.py | 228 +- .../platform/v1/resources/custom_objects.py | 62 +- src/archastro/platform/v1/resources/files.py | 16 +- .../v1/resources/installation_sources.py | 14 +- .../platform/v1/resources/invites.py | 14 +- .../v1/resources/knowledge_documents.py | 59 +- .../v1/resources/knowledge_sources.py | 74 +- src/archastro/platform/v1/resources/kv.py | 48 +- .../v1/resources/notification_preferences.py | 20 +- .../platform/v1/resources/notifications.py | 45 +- src/archastro/platform/v1/resources/orgs.py | 23 +- .../v1/resources/solution_categories.py | 39 +- .../platform/v1/resources/solution_tags.py | 36 +- .../platform/v1/resources/solutions.py | 66 +- .../platform/v1/resources/team_memberships.py | 36 +- src/archastro/platform/v1/resources/teams.py | 172 +- .../platform/v1/resources/thread_messages.py | 57 +- .../platform/v1/resources/threads.py | 100 +- src/archastro/platform/v1/resources/users.py | 69 +- tests/contract/v1/test_activity_feed.py | 111 +- tests/contract/v1/test_agent_computers.py | 394 ++- tests/contract/v1/test_agent_env_vars.py | 305 ++- .../contract/v1/test_agent_health_actions.py | 216 +- tests/contract/v1/test_agent_installations.py | 820 ++++-- tests/contract/v1/test_agent_routine_runs.py | 127 +- tests/contract/v1/test_agent_routines.py | 994 +++++-- tests/contract/v1/test_agent_sessions.py | 711 ++++- tests/contract/v1/test_agent_skills.py | 685 ++++- tests/contract/v1/test_agent_tools.py | 661 ++++- tests/contract/v1/test_agents.py | 2430 +++++++++++++---- tests/contract/v1/test_ai.py | 481 +++- tests/contract/v1/test_artifacts.py | 530 +++- tests/contract/v1/test_automation_runs.py | 105 +- tests/contract/v1/test_automations.py | 127 +- tests/contract/v1/test_bug_reports.py | 197 +- tests/contract/v1/test_config.py | 1972 ++++++++++--- tests/contract/v1/test_custom_objects.py | 417 ++- tests/contract/v1/test_files.py | 64 +- .../contract/v1/test_installation_sources.py | 105 +- tests/contract/v1/test_invites.py | 171 +- tests/contract/v1/test_knowledge_documents.py | 378 ++- tests/contract/v1/test_knowledge_sources.py | 667 ++++- tests/contract/v1/test_kv.py | 593 +++- .../v1/test_notification_preferences.py | 273 +- tests/contract/v1/test_notifications.py | 645 ++++- tests/contract/v1/test_orgs.py | 89 +- tests/contract/v1/test_solution_categories.py | 83 +- tests/contract/v1/test_solution_tags.py | 83 +- tests/contract/v1/test_solutions.py | 841 ++++-- tests/contract/v1/test_team_memberships.py | 150 +- tests/contract/v1/test_teams.py | 1874 ++++++++++--- tests/contract/v1/test_thread_messages.py | 573 +++- tests/contract/v1/test_threads.py | 1554 ++++++++--- tests/contract/v1/test_users.py | 701 ++++- 76 files changed, 18800 insertions(+), 4032 deletions(-) diff --git a/package-lock.json b/package-lock.json index d3cdf65..42cc417 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,9 +17,9 @@ } }, "node_modules/@archastro/channel-harness": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/@archastro/channel-harness/-/channel-harness-0.1.2.tgz", - "integrity": "sha512-yV+tWw4l23XGpyGwL6zZWV6MIQWAn8bJLb6w1iOsAnKUIsOriVWzL4reaoyrBqIxFkNTyHNu8z32ivfVCS2LOg==", + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@archastro/channel-harness/-/channel-harness-0.2.0.tgz", + "integrity": "sha512-a/ycbtPbSNmdV30KRJD4AWE/8kg/S8qn4UJEXXDnCvH3MGCetPZw+zmxtH+GWW64uw1wjtn+EkDDVrxzHiebXQ==", "dev": true, "license": "MIT", "dependencies": { @@ -55,9 +55,9 @@ } }, "node_modules/@archastro/sdk-generator": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/@archastro/sdk-generator/-/sdk-generator-0.3.2.tgz", - "integrity": "sha512-tmynQQ6J2NP7MIjerHrk6Hwp00D9cV00xDLgaC3eX2GTEzuUhrGw7bdbcsqd1cExMcV042M6X9wmO1RCE7EeHQ==", + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/@archastro/sdk-generator/-/sdk-generator-0.5.0.tgz", + "integrity": "sha512-7KjxeqO2ak1XyGMfabFjgutLm61Q0rUYc2C/2HNBCTy6t7JNClVKzRy0IF1qVxA6rkZo3+3EzuxKVp1WFfj7ow==", "dev": true, "license": "MIT", "dependencies": { diff --git a/src/archastro/platform/__init__.py b/src/archastro/platform/__init__.py index c9b655f..a8339cf 100644 --- a/src/archastro/platform/__init__.py +++ b/src/archastro/platform/__init__.py @@ -1,11 +1,14 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: 02004325aba1 +# Content hash: 8c6cb3d00016 from importlib.metadata import version as _pkg_version -from .auth import AuthClient, AuthTokens # noqa: F401 -from .client import PlatformClient # noqa: F401 -from .v1 import V1 # noqa: F401 +from .auth import AsyncAuthClient, AuthClient, AuthTokens # noqa: F401 +from .client import AsyncPlatformClient, PlatformClient # noqa: F401 +from .v1 import ( + V1, # noqa: F401 + AsyncV1, # noqa: F401 +) __version__ = _pkg_version("archastro-sdk") diff --git a/src/archastro/platform/auth.py b/src/archastro/platform/auth.py index 89ec48e..c227d21 100644 --- a/src/archastro/platform/auth.py +++ b/src/archastro/platform/auth.py @@ -1,12 +1,12 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: e1c481420189 +# Content hash: ac0e3a9724dc from __future__ import annotations from dataclasses import dataclass -from .runtime.http_client import HttpClient +from .runtime.http_client import HttpClient, SyncHttpClient @dataclass @@ -16,7 +16,7 @@ class AuthTokens: access_token: str | None = None -class AuthClient: +class AsyncAuthClient: def __init__(self, http: HttpClient): self._http = http @@ -185,3 +185,172 @@ async def verify_magic_link(self, token: str | None = None) -> AuthTokens: refresh_token=data.get("refresh_token"), access_token=data.get("token"), ) + + +class AuthClient: + def __init__(self, http: SyncHttpClient): + self._http = http + + def allowed_auth_methods(self) -> dict: + data = self._http.request( + "/api/v1/auth/allowed_auth_methods", + method="GET", + ) + return data + + def login(self, email: str, password: str) -> AuthTokens: + body: dict[str, object] = {} + body["email"] = email + body["password"] = password + + data = self._http.request( + "/api/v1/auth/login", + method="POST", + body=body, + ) + return AuthTokens( + token_expiry=data.get("expires_in"), + refresh_token=data.get("refresh_token"), + access_token=data.get("token"), + ) + + def request_login_magic_link( + self, email: str | None = None, redirect_uri: str | None = None + ) -> dict: + body: dict[str, object] = {} + if email is not None: + body["email"] = email + if redirect_uri is not None: + body["redirect_uri"] = redirect_uri + + data = self._http.request( + "/api/v1/auth/login/link", + method="POST", + body=body, + ) + return data + + def refresh(self, refresh_token: str) -> AuthTokens: + body: dict[str, object] = {} + body["refresh_token"] = refresh_token + + data = self._http.request( + "/api/v1/auth/refresh", + method="POST", + body=body, + ) + return AuthTokens( + token_expiry=data.get("expires_in"), + refresh_token=data.get("refresh_token"), + access_token=data.get("token"), + ) + + def register( + self, + email: str, + alias: str | None = None, + full_name: str | None = None, + invite_code: str | None = None, + password: str | None = None, + team_invite: str | None = None, + timezone: str | None = None, + ) -> AuthTokens: + body: dict[str, object] = {} + body["email"] = email + if alias is not None: + body["alias"] = alias + if full_name is not None: + body["full_name"] = full_name + if invite_code is not None: + body["invite_code"] = invite_code + if password is not None: + body["password"] = password + if team_invite is not None: + body["team_invite"] = team_invite + if timezone is not None: + body["timezone"] = timezone + + data = self._http.request( + "/api/v1/auth/register", + method="POST", + body=body, + ) + return AuthTokens( + token_expiry=data.get("expires_in"), + refresh_token=data.get("refresh_token"), + access_token=data.get("token"), + ) + + def request_register_magic_link( + self, + alias: str | None = None, + email: str | None = None, + full_name: str | None = None, + redirect_uri: str | None = None, + timezone: str | None = None, + ) -> dict: + body: dict[str, object] = {} + if alias is not None: + body["alias"] = alias + if email is not None: + body["email"] = email + if full_name is not None: + body["full_name"] = full_name + if redirect_uri is not None: + body["redirect_uri"] = redirect_uri + if timezone is not None: + body["timezone"] = timezone + + data = self._http.request( + "/api/v1/auth/register/link", + method="POST", + body=body, + ) + return data + + def request_magic_link(self, email: str | None = None, redirect_uri: str | None = None) -> dict: + body: dict[str, object] = {} + if email is not None: + body["email"] = email + if redirect_uri is not None: + body["redirect_uri"] = redirect_uri + + data = self._http.request( + "/api/v1/auth/request/link", + method="POST", + body=body, + ) + return data + + def exchange_login_token(self, token: str, timezone: str | None = None) -> AuthTokens: + body: dict[str, object] = {} + body["token"] = token + if timezone is not None: + body["timezone"] = timezone + + data = self._http.request( + "/api/v1/auth/token", + method="POST", + body=body, + ) + return AuthTokens( + token_expiry=data.get("expires_in"), + refresh_token=data.get("refresh_token"), + access_token=data.get("token"), + ) + + def verify_magic_link(self, token: str | None = None) -> AuthTokens: + body: dict[str, object] = {} + if token is not None: + body["token"] = token + + data = self._http.request( + "/api/v1/auth/verify/link", + method="POST", + body=body, + ) + return AuthTokens( + token_expiry=data.get("expires_in"), + refresh_token=data.get("refresh_token"), + access_token=data.get("token"), + ) diff --git a/src/archastro/platform/client.py b/src/archastro/platform/client.py index d8a9895..2d71e70 100644 --- a/src/archastro/platform/client.py +++ b/src/archastro/platform/client.py @@ -1,13 +1,17 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: 64af91ed4f30 +# Content hash: de84af350289 -from .auth import AuthClient -from .runtime.http_client import HttpClient -from .v1 import V1 +from urllib.parse import urlparse, urlunparse +from archastro.phx_channel import Socket -class PlatformClient: +from .auth import AsyncAuthClient, AuthClient +from .runtime.http_client import HttpClient, SyncHttpClient +from .v1 import V1, AsyncV1 + + +class AsyncPlatformClient: def __init__( self, *, @@ -18,6 +22,10 @@ def __init__( path_prefix: str | None = None, default_headers: dict[str, str] | None = None, ): + self._base_url = base_url + self._access_token = access_token + self._get_access_token = get_access_token + self._default_headers = default_headers or {} self._http = HttpClient( base_url=base_url, access_token=access_token, @@ -26,8 +34,8 @@ def __init__( path_prefix=path_prefix, default_headers=default_headers, ) - self.auth = AuthClient(self._http) - self.v1 = V1(self._http) + self.auth = AsyncAuthClient(self._http) + self.v1 = AsyncV1(self._http) self.activity_feed = self.v1.activity_feed self.agent_computers = self.v1.agent_computers self.agent_env_vars = self.v1.agent_env_vars @@ -64,21 +72,109 @@ def __init__( self.users = self.v1.users self.ai = self.v1.ai self._refresh_token: str | None = None + self._extra_http_clients: list[HttpClient] = [] + self._sockets: list[Socket] = [] @property def refresh_token(self) -> str | None: return self._refresh_token def set_access_token(self, token: str): + self._access_token = token self._http.set_access_token(token) def set_refresh_token(self, token: str): self._refresh_token = token + async def __aenter__(self): + return self + + async def __aexit__(self, exc_type, exc, tb): + await self.close() + + async def close(self): + try: + try: + for socket in self._sockets: + await socket.disconnect() + finally: + self._sockets.clear() + await self._http.close() + finally: + for http in self._extra_http_clients: + await http.close() + self._extra_http_clients.clear() + + def _current_access_token(self) -> str | None: + if self._get_access_token: + return self._get_access_token() + return self._access_token + + def _api_key(self) -> str | None: + for key, value in self._default_headers.items(): + if key.lower() == "x-archastro-api-key".lower(): + return value + return None + + def _socket_params(self, params: dict[str, str] | None = None) -> dict[str, str]: + socket_params: dict[str, str] = {} + api_key = self._api_key() + if api_key: + socket_params["api_key"] = api_key + token = self._current_access_token() + if token: + socket_params["token"] = token + if params: + socket_params.update(params) + return socket_params + + def _default_websocket_url(self) -> str: + parsed = urlparse(self._base_url) + scheme = ( + "wss" + if parsed.scheme == "https" + else "ws" + if parsed.scheme == "http" + else parsed.scheme + ) + path = parsed.path.rstrip("/") + "/socket/api/websocket" + return urlunparse( + parsed._replace(scheme=scheme, path=path, params="", query="", fragment="") + ) + + async def open_socket( + self, + *, + url: str | None = None, + params: dict[str, str] | None = None, + connect: bool = True, + heartbeat_interval: float = 30, + timeout: float = 10, + reconnect_backoff_ms: list[int] | None = None, + auto_reconnect: bool = True, + ) -> Socket: + socket_params = self._socket_params(params) + if connect and not socket_params.get("token"): + raise ValueError("AsyncPlatformClient.open_socket requires an access token") + socket = Socket( + url or self._default_websocket_url(), + params=socket_params, + heartbeat_interval=heartbeat_interval, + timeout=timeout, + reconnect_backoff_ms=reconnect_backoff_ms, + auto_reconnect=auto_reconnect, + ) + if connect: + await socket.connect() + if not socket.is_connected: + raise ConnectionError("WebSocket connection failed") + self._sockets.append(socket) + return socket + # ─── Factory constructors (generated from auth schemes) ─── @classmethod - def with_secret_key(cls, key: str, base_url: str | None = None) -> "PlatformClient": + def with_secret_key(cls, key: str, base_url: str | None = None) -> "AsyncPlatformClient": """Secret API key — full admin access, no user JWT required""" kwargs = {} if base_url: @@ -88,7 +184,7 @@ def with_secret_key(cls, key: str, base_url: str | None = None) -> "PlatformClie @classmethod def with_token( cls, api_key: str, access_token: str, base_url: str | None = None - ) -> "PlatformClient": + ) -> "AsyncPlatformClient": """Create a client with a publishable key and pre-existing access token.""" kwargs = {} if base_url: @@ -100,7 +196,7 @@ def with_token( @classmethod async def with_credentials( cls, api_key: str, email: str, password: str, base_url: str | None = None - ) -> "PlatformClient": + ) -> "AsyncPlatformClient": """Create a client by logging in with email/password""" kwargs = {} if base_url: @@ -117,7 +213,8 @@ async def with_credentials( default_headers={"x-archastro-api-key": api_key}, refresh_only=True, ) - refresh_auth = AuthClient(refresh_http) + client._extra_http_clients.append(refresh_http) + refresh_auth = AsyncAuthClient(refresh_http) async def _refresh() -> str: rt = client.refresh_token @@ -133,3 +230,150 @@ async def _refresh() -> str: client._http.set_refresh_handler(_refresh) return client + + +class PlatformClient: + def __init__( + self, + *, + base_url: str = "https://platform.archastro.ai", + access_token: str | None = None, + get_access_token=None, + on_refresh_token=None, + path_prefix: str | None = None, + default_headers: dict[str, str] | None = None, + ): + self._closed = False + self._http = SyncHttpClient( + base_url=base_url, + access_token=access_token, + get_access_token=get_access_token, + on_refresh_token=on_refresh_token, + path_prefix=path_prefix, + default_headers=default_headers, + ) + self.auth = AuthClient(self._http) + self.v1 = V1(self._http) + self.activity_feed = self.v1.activity_feed + self.agent_computers = self.v1.agent_computers + self.agent_env_vars = self.v1.agent_env_vars + self.agent_health_actions = self.v1.agent_health_actions + self.agent_installations = self.v1.agent_installations + self.agent_routine_runs = self.v1.agent_routine_runs + self.agent_routines = self.v1.agent_routines + self.agent_sessions = self.v1.agent_sessions + self.agent_skills = self.v1.agent_skills + self.agent_tools = self.v1.agent_tools + self.agents = self.v1.agents + self.artifacts = self.v1.artifacts + self.automation_runs = self.v1.automation_runs + self.automations = self.v1.automations + self.bug_reports = self.v1.bug_reports + self.config = self.v1.config + self.custom_objects = self.v1.custom_objects + self.files = self.v1.files + self.installation_sources = self.v1.installation_sources + self.invites = self.v1.invites + self.knowledge_documents = self.v1.knowledge_documents + self.knowledge_sources = self.v1.knowledge_sources + self.kv = self.v1.kv + self.notification_preferences = self.v1.notification_preferences + self.notifications = self.v1.notifications + self.orgs = self.v1.orgs + self.solution_categories = self.v1.solution_categories + self.solution_tags = self.v1.solution_tags + self.solutions = self.v1.solutions + self.team_memberships = self.v1.team_memberships + self.teams = self.v1.teams + self.thread_messages = self.v1.thread_messages + self.threads = self.v1.threads + self.users = self.v1.users + self.ai = self.v1.ai + self._refresh_token: str | None = None + self._extra_http_clients: list[SyncHttpClient] = [] + + @property + def refresh_token(self) -> str | None: + return self._refresh_token + + def set_access_token(self, token: str): + self._http.set_access_token(token) + + def set_refresh_token(self, token: str): + self._refresh_token = token + + def __enter__(self): + return self + + def __exit__(self, exc_type, exc, tb): + self.close() + + def close(self): + if self._closed: + return + self._closed = True + try: + self._http.close() + finally: + for http in self._extra_http_clients: + http.close() + self._extra_http_clients.clear() + + # ─── Factory constructors (generated from auth schemes) ─── + + @classmethod + def with_secret_key(cls, key: str, base_url: str | None = None) -> "PlatformClient": + """Secret API key — full admin access, no user JWT required""" + kwargs = {} + if base_url: + kwargs["base_url"] = base_url + return cls(default_headers={"x-archastro-api-key": key}, **kwargs) + + @classmethod + def with_token( + cls, api_key: str, access_token: str, base_url: str | None = None + ) -> "PlatformClient": + """Create a client with a publishable key and pre-existing access token.""" + kwargs = {} + if base_url: + kwargs["base_url"] = base_url + return cls( + access_token=access_token, default_headers={"x-archastro-api-key": api_key}, **kwargs + ) + + @classmethod + def with_credentials( + cls, api_key: str, email: str, password: str, base_url: str | None = None + ) -> "PlatformClient": + kwargs = {} + if base_url: + kwargs["base_url"] = base_url + client = cls(default_headers={"x-archastro-api-key": api_key}, **kwargs) + tokens = client.auth.login(email, password) + if not tokens.access_token: + raise ValueError("Login did not return an access token") + client.set_access_token(tokens.access_token) + if tokens.refresh_token: + client.set_refresh_token(tokens.refresh_token) + refresh_http = SyncHttpClient( + base_url=base_url or "https://platform.archastro.ai", + default_headers={"x-archastro-api-key": api_key}, + refresh_only=True, + ) + client._extra_http_clients.append(refresh_http) + refresh_auth = AuthClient(refresh_http) + + def _refresh() -> str: + rt = client.refresh_token + if not rt: + raise ValueError("No refresh token available") + refreshed = refresh_auth.refresh(rt) + if not refreshed.access_token: + raise ValueError("Refresh did not return an access token") + client.set_access_token(refreshed.access_token) + if refreshed.refresh_token: + client.set_refresh_token(refreshed.refresh_token) + return refreshed.access_token + + client._http.set_refresh_handler(_refresh) + return client diff --git a/src/archastro/platform/v1/__init__.py b/src/archastro/platform/v1/__init__.py index 6ba27d7..1ceb2d3 100644 --- a/src/archastro/platform/v1/__init__.py +++ b/src/archastro/platform/v1/__init__.py @@ -1,47 +1,56 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: 0fabd91cd114 +# Content hash: 0f8da228c48c -from ..runtime.http_client import HttpClient -from .resources.activity_feed import ActivityFeedResource -from .resources.agent_computers import AgentComputerResource -from .resources.agent_env_vars import AgentEnvVarResource -from .resources.agent_health_actions import AgentHealthActionResource -from .resources.agent_installations import AgentInstallationResource -from .resources.agent_routine_runs import AgentRoutineRunResource -from .resources.agent_routines import AgentRoutineResource -from .resources.agent_sessions import AgentSessionResource -from .resources.agent_skills import AgentSkillResource -from .resources.agent_tools import AgentToolResource -from .resources.agents import AgentResource -from .resources.ai import AiResource -from .resources.artifacts import ArtifactResource -from .resources.automation_runs import AutomationRunResource -from .resources.automations import AutomationResource -from .resources.bug_reports import BugReportResource -from .resources.config import ConfigResource -from .resources.custom_objects import CustomObjectResource -from .resources.files import FileResource -from .resources.installation_sources import InstallationSourceResource -from .resources.invites import InviteResource -from .resources.knowledge_documents import KnowledgeDocumentResource -from .resources.knowledge_sources import KnowledgeSourceResource -from .resources.kv import KvResource -from .resources.notification_preferences import NotificationPreferenceResource -from .resources.notifications import NotificationResource -from .resources.orgs import OrgResource -from .resources.solution_categories import SolutionCategoryResource -from .resources.solution_tags import SolutionTagResource -from .resources.solutions import SolutionResource -from .resources.team_memberships import TeamMembershipResource -from .resources.teams import TeamResource -from .resources.thread_messages import ThreadMessageResource -from .resources.threads import ThreadResource -from .resources.users import UserResource +from ..runtime.http_client import HttpClient, SyncHttpClient +from .resources.activity_feed import ActivityFeedResource, AsyncActivityFeedResource +from .resources.agent_computers import AgentComputerResource, AsyncAgentComputerResource +from .resources.agent_env_vars import AgentEnvVarResource, AsyncAgentEnvVarResource +from .resources.agent_health_actions import ( + AgentHealthActionResource, + AsyncAgentHealthActionResource, +) +from .resources.agent_installations import AgentInstallationResource, AsyncAgentInstallationResource +from .resources.agent_routine_runs import AgentRoutineRunResource, AsyncAgentRoutineRunResource +from .resources.agent_routines import AgentRoutineResource, AsyncAgentRoutineResource +from .resources.agent_sessions import AgentSessionResource, AsyncAgentSessionResource +from .resources.agent_skills import AgentSkillResource, AsyncAgentSkillResource +from .resources.agent_tools import AgentToolResource, AsyncAgentToolResource +from .resources.agents import AgentResource, AsyncAgentResource +from .resources.ai import AiResource, AsyncAiResource +from .resources.artifacts import ArtifactResource, AsyncArtifactResource +from .resources.automation_runs import AsyncAutomationRunResource, AutomationRunResource +from .resources.automations import AsyncAutomationResource, AutomationResource +from .resources.bug_reports import AsyncBugReportResource, BugReportResource +from .resources.config import AsyncConfigResource, ConfigResource +from .resources.custom_objects import AsyncCustomObjectResource, CustomObjectResource +from .resources.files import AsyncFileResource, FileResource +from .resources.installation_sources import ( + AsyncInstallationSourceResource, + InstallationSourceResource, +) +from .resources.invites import AsyncInviteResource, InviteResource +from .resources.knowledge_documents import AsyncKnowledgeDocumentResource, KnowledgeDocumentResource +from .resources.knowledge_sources import AsyncKnowledgeSourceResource, KnowledgeSourceResource +from .resources.kv import AsyncKvResource, KvResource +from .resources.notification_preferences import ( + AsyncNotificationPreferenceResource, + NotificationPreferenceResource, +) +from .resources.notifications import AsyncNotificationResource, NotificationResource +from .resources.orgs import AsyncOrgResource, OrgResource +from .resources.solution_categories import AsyncSolutionCategoryResource, SolutionCategoryResource +from .resources.solution_tags import AsyncSolutionTagResource, SolutionTagResource +from .resources.solutions import AsyncSolutionResource, SolutionResource +from .resources.team_memberships import AsyncTeamMembershipResource, TeamMembershipResource +from .resources.teams import AsyncTeamResource, TeamResource +from .resources.thread_messages import AsyncThreadMessageResource, ThreadMessageResource +from .resources.threads import AsyncThreadResource, ThreadResource +from .resources.users import AsyncUserResource, UserResource class V1: - def __init__(self, http: HttpClient): + def __init__(self, http: SyncHttpClient): self.activity_feed = ActivityFeedResource(http) self.agent_computers = AgentComputerResource(http) self.agent_env_vars = AgentEnvVarResource(http) @@ -77,3 +86,42 @@ def __init__(self, http: HttpClient): self.threads = ThreadResource(http) self.users = UserResource(http) self.ai = AiResource(http) + + +class AsyncV1: + def __init__(self, http: HttpClient): + self.activity_feed = AsyncActivityFeedResource(http) + self.agent_computers = AsyncAgentComputerResource(http) + self.agent_env_vars = AsyncAgentEnvVarResource(http) + self.agent_health_actions = AsyncAgentHealthActionResource(http) + self.agent_installations = AsyncAgentInstallationResource(http) + self.agent_routine_runs = AsyncAgentRoutineRunResource(http) + self.agent_routines = AsyncAgentRoutineResource(http) + self.agent_sessions = AsyncAgentSessionResource(http) + self.agent_skills = AsyncAgentSkillResource(http) + self.agent_tools = AsyncAgentToolResource(http) + self.agents = AsyncAgentResource(http) + self.artifacts = AsyncArtifactResource(http) + self.automation_runs = AsyncAutomationRunResource(http) + self.automations = AsyncAutomationResource(http) + self.bug_reports = AsyncBugReportResource(http) + self.config = AsyncConfigResource(http) + self.custom_objects = AsyncCustomObjectResource(http) + self.files = AsyncFileResource(http) + self.installation_sources = AsyncInstallationSourceResource(http) + self.invites = AsyncInviteResource(http) + self.knowledge_documents = AsyncKnowledgeDocumentResource(http) + self.knowledge_sources = AsyncKnowledgeSourceResource(http) + self.kv = AsyncKvResource(http) + self.notification_preferences = AsyncNotificationPreferenceResource(http) + self.notifications = AsyncNotificationResource(http) + self.orgs = AsyncOrgResource(http) + self.solution_categories = AsyncSolutionCategoryResource(http) + self.solution_tags = AsyncSolutionTagResource(http) + self.solutions = AsyncSolutionResource(http) + self.team_memberships = AsyncTeamMembershipResource(http) + self.teams = AsyncTeamResource(http) + self.thread_messages = AsyncThreadMessageResource(http) + self.threads = AsyncThreadResource(http) + self.users = AsyncUserResource(http) + self.ai = AsyncAiResource(http) diff --git a/src/archastro/platform/v1/resources/__init__.py b/src/archastro/platform/v1/resources/__init__.py index 429068f..88a456c 100644 --- a/src/archastro/platform/v1/resources/__init__.py +++ b/src/archastro/platform/v1/resources/__init__.py @@ -1,39 +1,144 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: 7ae69dc57441 +# Content hash: ad2ceedee69a -from .activity_feed import ActivityFeedResource # noqa: F401 -from .agent_computers import AgentComputerResource # noqa: F401 -from .agent_env_vars import AgentEnvVarResource # noqa: F401 -from .agent_health_actions import AgentHealthActionResource # noqa: F401 -from .agent_installations import AgentInstallationResource # noqa: F401 -from .agent_routine_runs import AgentRoutineRunResource # noqa: F401 -from .agent_routines import AgentRoutineResource # noqa: F401 -from .agent_sessions import AgentSessionResource # noqa: F401 -from .agent_skills import AgentSkillResource # noqa: F401 -from .agent_tools import AgentToolResource # noqa: F401 -from .agents import AgentResource # noqa: F401 -from .ai import AiResource # noqa: F401 -from .artifacts import ArtifactResource # noqa: F401 -from .automation_runs import AutomationRunResource # noqa: F401 -from .automations import AutomationResource # noqa: F401 -from .bug_reports import BugReportResource # noqa: F401 -from .config import ConfigResource # noqa: F401 -from .custom_objects import CustomObjectResource # noqa: F401 -from .files import FileResource # noqa: F401 -from .installation_sources import InstallationSourceResource # noqa: F401 -from .invites import InviteResource # noqa: F401 -from .knowledge_documents import KnowledgeDocumentResource # noqa: F401 -from .knowledge_sources import KnowledgeSourceResource # noqa: F401 -from .kv import KvResource # noqa: F401 -from .notification_preferences import NotificationPreferenceResource # noqa: F401 -from .notifications import NotificationResource # noqa: F401 -from .orgs import OrgResource # noqa: F401 -from .solution_categories import SolutionCategoryResource # noqa: F401 -from .solution_tags import SolutionTagResource # noqa: F401 -from .solutions import SolutionResource # noqa: F401 -from .team_memberships import TeamMembershipResource # noqa: F401 -from .teams import TeamResource # noqa: F401 -from .thread_messages import ThreadMessageResource # noqa: F401 -from .threads import ThreadResource # noqa: F401 -from .users import UserResource # noqa: F401 +from .activity_feed import ( + ActivityFeedResource, # noqa: F401 + AsyncActivityFeedResource, # noqa: F401 +) +from .agent_computers import ( + AgentComputerResource, # noqa: F401 + AsyncAgentComputerResource, # noqa: F401 +) +from .agent_env_vars import ( + AgentEnvVarResource, # noqa: F401 + AsyncAgentEnvVarResource, # noqa: F401 +) +from .agent_health_actions import ( + AgentHealthActionResource, # noqa: F401 + AsyncAgentHealthActionResource, # noqa: F401 +) +from .agent_installations import ( + AgentInstallationResource, # noqa: F401 + AsyncAgentInstallationResource, # noqa: F401 +) +from .agent_routine_runs import ( + AgentRoutineRunResource, # noqa: F401 + AsyncAgentRoutineRunResource, # noqa: F401 +) +from .agent_routines import ( + AgentRoutineResource, # noqa: F401 + AsyncAgentRoutineResource, # noqa: F401 +) +from .agent_sessions import ( + AgentSessionResource, # noqa: F401 + AsyncAgentSessionResource, # noqa: F401 +) +from .agent_skills import ( + AgentSkillResource, # noqa: F401 + AsyncAgentSkillResource, # noqa: F401 +) +from .agent_tools import ( + AgentToolResource, # noqa: F401 + AsyncAgentToolResource, # noqa: F401 +) +from .agents import ( + AgentResource, # noqa: F401 + AsyncAgentResource, # noqa: F401 +) +from .ai import ( + AiResource, # noqa: F401 + AsyncAiResource, # noqa: F401 +) +from .artifacts import ( + ArtifactResource, # noqa: F401 + AsyncArtifactResource, # noqa: F401 +) +from .automation_runs import ( + AsyncAutomationRunResource, # noqa: F401 + AutomationRunResource, # noqa: F401 +) +from .automations import ( + AsyncAutomationResource, # noqa: F401 + AutomationResource, # noqa: F401 +) +from .bug_reports import ( + AsyncBugReportResource, # noqa: F401 + BugReportResource, # noqa: F401 +) +from .config import ( + AsyncConfigResource, # noqa: F401 + ConfigResource, # noqa: F401 +) +from .custom_objects import ( + AsyncCustomObjectResource, # noqa: F401 + CustomObjectResource, # noqa: F401 +) +from .files import ( + AsyncFileResource, # noqa: F401 + FileResource, # noqa: F401 +) +from .installation_sources import ( + AsyncInstallationSourceResource, # noqa: F401 + InstallationSourceResource, # noqa: F401 +) +from .invites import ( + AsyncInviteResource, # noqa: F401 + InviteResource, # noqa: F401 +) +from .knowledge_documents import ( + AsyncKnowledgeDocumentResource, # noqa: F401 + KnowledgeDocumentResource, # noqa: F401 +) +from .knowledge_sources import ( + AsyncKnowledgeSourceResource, # noqa: F401 + KnowledgeSourceResource, # noqa: F401 +) +from .kv import ( + AsyncKvResource, # noqa: F401 + KvResource, # noqa: F401 +) +from .notification_preferences import ( + AsyncNotificationPreferenceResource, # noqa: F401 + NotificationPreferenceResource, # noqa: F401 +) +from .notifications import ( + AsyncNotificationResource, # noqa: F401 + NotificationResource, # noqa: F401 +) +from .orgs import ( + AsyncOrgResource, # noqa: F401 + OrgResource, # noqa: F401 +) +from .solution_categories import ( + AsyncSolutionCategoryResource, # noqa: F401 + SolutionCategoryResource, # noqa: F401 +) +from .solution_tags import ( + AsyncSolutionTagResource, # noqa: F401 + SolutionTagResource, # noqa: F401 +) +from .solutions import ( + AsyncSolutionResource, # noqa: F401 + SolutionResource, # noqa: F401 +) +from .team_memberships import ( + AsyncTeamMembershipResource, # noqa: F401 + TeamMembershipResource, # noqa: F401 +) +from .teams import ( + AsyncTeamResource, # noqa: F401 + TeamResource, # noqa: F401 +) +from .thread_messages import ( + AsyncThreadMessageResource, # noqa: F401 + ThreadMessageResource, # noqa: F401 +) +from .threads import ( + AsyncThreadResource, # noqa: F401 + ThreadResource, # noqa: F401 +) +from .users import ( + AsyncUserResource, # noqa: F401 + UserResource, # noqa: F401 +) diff --git a/src/archastro/platform/v1/resources/activity_feed.py b/src/archastro/platform/v1/resources/activity_feed.py index 78d3a4b..3c05b4f 100644 --- a/src/archastro/platform/v1/resources/activity_feed.py +++ b/src/archastro/platform/v1/resources/activity_feed.py @@ -1,6 +1,6 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: e3aa24a6e488 +# Content hash: 18554f0c6d62 from __future__ import annotations @@ -8,7 +8,7 @@ from pydantic import BaseModel -from ...runtime.http_client import HttpClient +from ...runtime.http_client import HttpClient, SyncHttpClient class ActivityFeedListResponseDataItem(BaseModel): @@ -41,7 +41,7 @@ class ActivityFeedListResponse(BaseModel): has_more: bool # Whether more items exist beyond this page -class ActivityFeedResource: +class AsyncActivityFeedResource: def __init__(self, http: HttpClient): self._http = http @@ -81,3 +81,45 @@ async def list( if after_cursor is not None: query["afterCursor"] = after_cursor return await self._http.request("/api/v1/activity_feed", query=query) + + +class ActivityFeedResource: + def __init__(self, http: SyncHttpClient): + self._http = http + + def list( + self, + *, + kind: list[str] | None = None, + level: list[str] | None = None, + agent: list[str] | None = None, + thread: list[str] | None = None, + team: list[str] | None = None, + org: list[str] | None = None, + correlation_id: str | None = None, + limit: int | None = None, + before_cursor: str | None = None, + after_cursor: str | None = None, + ) -> ActivityFeedListResponse: + query: dict[str, object] = {} + if kind is not None: + query["kind"] = kind + if level is not None: + query["level"] = level + if agent is not None: + query["agent"] = agent + if thread is not None: + query["thread"] = thread + if team is not None: + query["team"] = team + if org is not None: + query["org"] = org + if correlation_id is not None: + query["correlationId"] = correlation_id + if limit is not None: + query["limit"] = limit + if before_cursor is not None: + query["beforeCursor"] = before_cursor + if after_cursor is not None: + query["afterCursor"] = after_cursor + return self._http.request("/api/v1/activity_feed", query=query) diff --git a/src/archastro/platform/v1/resources/agent_computers.py b/src/archastro/platform/v1/resources/agent_computers.py index f08a1d8..50757d4 100644 --- a/src/archastro/platform/v1/resources/agent_computers.py +++ b/src/archastro/platform/v1/resources/agent_computers.py @@ -1,12 +1,12 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: db81397daf68 +# Content hash: 4687ea54d65a from __future__ import annotations from typing import Required, TypedDict -from ...runtime.http_client import HttpClient +from ...runtime.http_client import HttpClient, SyncHttpClient from ...types.common import AgentComputer, ComputerExecResult @@ -15,7 +15,7 @@ class AgentComputerExecInput(TypedDict, total=False): dir: str | None # Working directory for the command -class AgentComputerResource: +class AsyncAgentComputerResource: def __init__(self, http: HttpClient): self._http = http @@ -37,3 +37,24 @@ async def refresh(self, computer: str) -> AgentComputer: f"/api/v1/agent_computers/{computer}/refresh", method="POST", ) + + +class AgentComputerResource: + def __init__(self, http: SyncHttpClient): + self._http = http + + def delete(self, computer: str) -> None: + self._http.request(f"/api/v1/agent_computers/{computer}", method="DELETE") + + def get(self, computer: str) -> AgentComputer: + return self._http.request(f"/api/v1/agent_computers/{computer}") + + def exec(self, computer: str, input: AgentComputerExecInput) -> ComputerExecResult: + return self._http.request( + f"/api/v1/agent_computers/{computer}/exec", + method="POST", + body=input, + ) + + def refresh(self, computer: str) -> AgentComputer: + return self._http.request(f"/api/v1/agent_computers/{computer}/refresh", method="POST") diff --git a/src/archastro/platform/v1/resources/agent_env_vars.py b/src/archastro/platform/v1/resources/agent_env_vars.py index cd699c7..d01d27b 100644 --- a/src/archastro/platform/v1/resources/agent_env_vars.py +++ b/src/archastro/platform/v1/resources/agent_env_vars.py @@ -1,12 +1,12 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: 0e5e91df3c97 +# Content hash: a0981cda95c0 from __future__ import annotations from typing import TypedDict -from ...runtime.http_client import HttpClient +from ...runtime.http_client import HttpClient, SyncHttpClient from ...types.common import AgentEnvVarMasked @@ -15,7 +15,7 @@ class AgentEnvVarUpdateInput(TypedDict, total=False): value: str | None # New value -class AgentEnvVarResource: +class AsyncAgentEnvVarResource: def __init__(self, http: HttpClient): self._http = http @@ -31,3 +31,17 @@ async def update(self, env_var: str, input: AgentEnvVarUpdateInput) -> AgentEnvV method="PATCH", body=input, ) + + +class AgentEnvVarResource: + def __init__(self, http: SyncHttpClient): + self._http = http + + def delete(self, env_var: str) -> None: + self._http.request(f"/api/v1/agent_env_vars/{env_var}", method="DELETE") + + def get(self, env_var: str) -> AgentEnvVarMasked: + return self._http.request(f"/api/v1/agent_env_vars/{env_var}") + + def update(self, env_var: str, input: AgentEnvVarUpdateInput) -> AgentEnvVarMasked: + return self._http.request(f"/api/v1/agent_env_vars/{env_var}", method="PATCH", body=input) diff --git a/src/archastro/platform/v1/resources/agent_health_actions.py b/src/archastro/platform/v1/resources/agent_health_actions.py index 6c3d9af..b784deb 100644 --- a/src/archastro/platform/v1/resources/agent_health_actions.py +++ b/src/archastro/platform/v1/resources/agent_health_actions.py @@ -1,14 +1,14 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: 12e45a765fbf +# Content hash: 290b7e74e240 from __future__ import annotations -from ...runtime.http_client import HttpClient +from ...runtime.http_client import HttpClient, SyncHttpClient from ...types.common import AgentHealthAction -class AgentHealthActionResource: +class AsyncAgentHealthActionResource: def __init__(self, http: HttpClient): self._http = http @@ -20,3 +20,17 @@ async def verify(self, health_action: str) -> AgentHealthAction: f"/api/v1/agent_health_actions/{health_action}/verify", method="POST", ) + + +class AgentHealthActionResource: + def __init__(self, http: SyncHttpClient): + self._http = http + + def get(self, health_action: str) -> AgentHealthAction: + return self._http.request(f"/api/v1/agent_health_actions/{health_action}") + + def verify(self, health_action: str) -> AgentHealthAction: + return self._http.request( + f"/api/v1/agent_health_actions/{health_action}/verify", + method="POST", + ) diff --git a/src/archastro/platform/v1/resources/agent_installations.py b/src/archastro/platform/v1/resources/agent_installations.py index a556d59..ca6cdfd 100644 --- a/src/archastro/platform/v1/resources/agent_installations.py +++ b/src/archastro/platform/v1/resources/agent_installations.py @@ -1,12 +1,12 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: 2ad07cd44267 +# Content hash: e49fa89f30d2 from __future__ import annotations from typing import TypedDict -from ...runtime.http_client import HttpClient +from ...runtime.http_client import HttpClient, SyncHttpClient from ...types.common import ( Installation, InstallationListResponse, @@ -24,7 +24,7 @@ class AgentInstallationSuspendInput(TypedDict, total=False): reason: str | None # Optional suspension reason -class AgentInstallationInstallationSourceResource: +class AsyncAgentInstallationInstallationSourceResource: def __init__(self, http: HttpClient): self._http = http @@ -43,10 +43,10 @@ async def create( ) -class AgentInstallationResource: +class AsyncAgentInstallationResource: def __init__(self, http: HttpClient): self._http = http - self.installation_sources = AgentInstallationInstallationSourceResource(http) + self.installation_sources = AsyncAgentInstallationInstallationSourceResource(http) async def list(self, *, agent: str | None = None) -> InstallationListResponse: query: dict[str, object] = {} @@ -80,3 +80,59 @@ async def suspend( method="POST", body=input, ) + + +class AgentInstallationInstallationSourceResource: + def __init__(self, http: SyncHttpClient): + self._http = http + + def list(self, installation: str) -> InstallationSourceListResponse: + return self._http.request( + f"/api/v1/agent_installations/{installation}/installation_sources", + ) + + def create( + self, installation: str, input: AgentInstallationInstallationSourceCreateInput + ) -> InstallationSource: + return self._http.request( + f"/api/v1/agent_installations/{installation}/installation_sources", + method="POST", + body=input, + ) + + +class AgentInstallationResource: + def __init__(self, http: SyncHttpClient): + self._http = http + self.installation_sources = AgentInstallationInstallationSourceResource(http) + + def list(self, *, agent: str | None = None) -> InstallationListResponse: + query: dict[str, object] = {} + if agent is not None: + query["agent"] = agent + return self._http.request("/api/v1/agent_installations", query=query) + + def delete(self, installation: str) -> None: + self._http.request(f"/api/v1/agent_installations/{installation}", method="DELETE") + + def get(self, installation: str) -> Installation: + return self._http.request(f"/api/v1/agent_installations/{installation}") + + def activate(self, installation: str) -> Installation: + return self._http.request( + f"/api/v1/agent_installations/{installation}/activate", + method="POST", + ) + + def pause(self, installation: str) -> Installation: + return self._http.request( + f"/api/v1/agent_installations/{installation}/pause", + method="POST", + ) + + def suspend(self, installation: str, input: AgentInstallationSuspendInput) -> Installation: + return self._http.request( + f"/api/v1/agent_installations/{installation}/suspend", + method="POST", + body=input, + ) diff --git a/src/archastro/platform/v1/resources/agent_routine_runs.py b/src/archastro/platform/v1/resources/agent_routine_runs.py index 53508cb..74c0a6a 100644 --- a/src/archastro/platform/v1/resources/agent_routine_runs.py +++ b/src/archastro/platform/v1/resources/agent_routine_runs.py @@ -1,14 +1,14 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: a9e233ba82f7 +# Content hash: 8e9ef1529914 from __future__ import annotations -from ...runtime.http_client import HttpClient +from ...runtime.http_client import HttpClient, SyncHttpClient from ...types.common import AgentRoutineRunListResponse -class AgentRoutineRunResource: +class AsyncAgentRoutineRunResource: def __init__(self, http: HttpClient): self._http = http @@ -33,3 +33,30 @@ async def list( if after_cursor is not None: query["afterCursor"] = after_cursor return await self._http.request("/api/v1/agent_routine_runs", query=query) + + +class AgentRoutineRunResource: + def __init__(self, http: SyncHttpClient): + self._http = http + + def list( + self, + *, + agent: list[str] | None = None, + status: str | None = None, + limit: int | None = None, + before_cursor: str | None = None, + after_cursor: str | None = None, + ) -> AgentRoutineRunListResponse: + query: dict[str, object] = {} + if agent is not None: + query["agent"] = agent + if status is not None: + query["status"] = status + if limit is not None: + query["limit"] = limit + if before_cursor is not None: + query["beforeCursor"] = before_cursor + if after_cursor is not None: + query["afterCursor"] = after_cursor + return self._http.request("/api/v1/agent_routine_runs", query=query) diff --git a/src/archastro/platform/v1/resources/agent_routines.py b/src/archastro/platform/v1/resources/agent_routines.py index 6382e3b..0e3f095 100644 --- a/src/archastro/platform/v1/resources/agent_routines.py +++ b/src/archastro/platform/v1/resources/agent_routines.py @@ -1,12 +1,12 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: db1fe5912526 +# Content hash: c8b8246cd761 from __future__ import annotations from typing import Required, TypedDict -from ...runtime.http_client import HttpClient +from ...runtime.http_client import HttpClient, SyncHttpClient from ...types.common import ( AgentRoutine, AgentRoutineListResponse, @@ -103,7 +103,7 @@ class AgentRoutineInvokeInput(TypedDict, total=False): user: str | None # User ID (S2S/developer only; client uses viewer) -class AgentRoutineRunResource: +class AsyncAgentRoutineRunResource: def __init__(self, http: HttpClient): self._http = http @@ -111,10 +111,10 @@ async def get(self, run: str) -> AgentRoutineRun: return await self._http.request(f"/api/v1/agent_routines/runs/{run}") -class AgentRoutineResource: +class AsyncAgentRoutineResource: def __init__(self, http: HttpClient): self._http = http - self.agent_routine_runs = AgentRoutineRunResource(http) + self.agent_routine_runs = AsyncAgentRoutineRunResource(http) async def list( self, *, agent: str | None = None, event_type: str | None = None @@ -174,3 +174,72 @@ async def runs( if after_cursor is not None: query["afterCursor"] = after_cursor return await self._http.request(f"/api/v1/agent_routines/{routine}/runs", query=query) + + +class AgentRoutineRunResource: + def __init__(self, http: SyncHttpClient): + self._http = http + + def get(self, run: str) -> AgentRoutineRun: + return self._http.request(f"/api/v1/agent_routines/runs/{run}") + + +class AgentRoutineResource: + def __init__(self, http: SyncHttpClient): + self._http = http + self.agent_routine_runs = AgentRoutineRunResource(http) + + def list( + self, *, agent: str | None = None, event_type: str | None = None + ) -> AgentRoutineListResponse: + query: dict[str, object] = {} + if agent is not None: + query["agent"] = agent + if event_type is not None: + query["eventType"] = event_type + return self._http.request("/api/v1/agent_routines", query=query) + + def presets(self) -> list[RoutinePreset]: + return self._http.request("/api/v1/agent_routines/presets") + + def delete(self, routine: str) -> None: + self._http.request(f"/api/v1/agent_routines/{routine}", method="DELETE") + + def get(self, routine: str) -> AgentRoutine: + return self._http.request(f"/api/v1/agent_routines/{routine}") + + def update(self, routine: str, input: AgentRoutineUpdateInput) -> AgentRoutine: + return self._http.request(f"/api/v1/agent_routines/{routine}", method="PATCH", body=input) + + def activate(self, routine: str) -> AgentRoutine: + return self._http.request(f"/api/v1/agent_routines/{routine}/activate", method="POST") + + def invoke(self, routine: str, input: AgentRoutineInvokeInput) -> AgentRoutineRun: + return self._http.request( + f"/api/v1/agent_routines/{routine}/invoke", + method="POST", + body=input, + ) + + def pause(self, routine: str) -> AgentRoutine: + return self._http.request(f"/api/v1/agent_routines/{routine}/pause", method="POST") + + def runs( + self, + routine: str, + *, + status: str | None = None, + limit: int | None = None, + before_cursor: str | None = None, + after_cursor: str | None = None, + ) -> AgentRoutineRunListResponse: + query: dict[str, object] = {} + if status is not None: + query["status"] = status + if limit is not None: + query["limit"] = limit + if before_cursor is not None: + query["beforeCursor"] = before_cursor + if after_cursor is not None: + query["afterCursor"] = after_cursor + return self._http.request(f"/api/v1/agent_routines/{routine}/runs", query=query) diff --git a/src/archastro/platform/v1/resources/agent_sessions.py b/src/archastro/platform/v1/resources/agent_sessions.py index 2f00c26..fb8f55a 100644 --- a/src/archastro/platform/v1/resources/agent_sessions.py +++ b/src/archastro/platform/v1/resources/agent_sessions.py @@ -1,12 +1,12 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: 347ca19aa6bb +# Content hash: d5c88060061f from __future__ import annotations from typing import Required, TypedDict -from ...runtime.http_client import HttpClient +from ...runtime.http_client import HttpClient, SyncHttpClient from ...types.common import AgentSession, AgentSessionListResponse @@ -33,7 +33,7 @@ class AgentSessionMessageInput(TypedDict, total=False): role: str | None # Message role (default: user) -class AgentSessionResource: +class AsyncAgentSessionResource: def __init__(self, http: HttpClient): self._http = http @@ -87,3 +87,56 @@ async def message(self, agent_session: str, input: AgentSessionMessageInput) -> method="POST", body=input, ) + + +class AgentSessionResource: + def __init__(self, http: SyncHttpClient): + self._http = http + + def list( + self, + *, + agent: str | None = None, + status: list[str] | None = None, + routine_run: list[str] | None = None, + exclude_system: bool | None = None, + limit: int | None = None, + ) -> AgentSessionListResponse: + query: dict[str, object] = {} + if agent is not None: + query["agent"] = agent + if status is not None: + query["status"] = status + if routine_run is not None: + query["routineRun"] = routine_run + if exclude_system is not None: + query["excludeSystem"] = exclude_system + if limit is not None: + query["limit"] = limit + return self._http.request("/api/v1/agent_sessions", query=query) + + def create(self, input: AgentSessionCreateInput) -> AgentSession: + return self._http.request("/api/v1/agent_sessions", method="POST", body=input) + + def delete(self, agent_session: str) -> None: + self._http.request(f"/api/v1/agent_sessions/{agent_session}", method="DELETE") + + def get(self, agent_session: str) -> AgentSession: + return self._http.request(f"/api/v1/agent_sessions/{agent_session}") + + def update(self, agent_session: str, input: AgentSessionUpdateInput) -> AgentSession: + return self._http.request( + f"/api/v1/agent_sessions/{agent_session}", + method="PATCH", + body=input, + ) + + def cancel(self, agent_session: str) -> AgentSession: + return self._http.request(f"/api/v1/agent_sessions/{agent_session}/cancel", method="POST") + + def message(self, agent_session: str, input: AgentSessionMessageInput) -> AgentSession: + return self._http.request( + f"/api/v1/agent_sessions/{agent_session}/message", + method="POST", + body=input, + ) diff --git a/src/archastro/platform/v1/resources/agent_skills.py b/src/archastro/platform/v1/resources/agent_skills.py index c154319..3b7445d 100644 --- a/src/archastro/platform/v1/resources/agent_skills.py +++ b/src/archastro/platform/v1/resources/agent_skills.py @@ -1,12 +1,12 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: 04921686b61c +# Content hash: 0931502bf4de from __future__ import annotations from typing import Required, TypedDict -from ...runtime.http_client import HttpClient +from ...runtime.http_client import HttpClient, SyncHttpClient from ...types.common import AgentSkill, AgentSkillList @@ -23,7 +23,7 @@ class AgentSkillUpdateInput(TypedDict, total=False): template: str | None -class AgentSkillResource: +class AsyncAgentSkillResource: def __init__(self, http: HttpClient): self._http = http @@ -60,3 +60,32 @@ async def deactivate(self, agent_skill: str) -> AgentSkill: f"/api/v1/agent_skills/{agent_skill}/deactivate", method="POST", ) + + +class AgentSkillResource: + def __init__(self, http: SyncHttpClient): + self._http = http + + def list(self, *, agent: list[str] | None = None) -> AgentSkillList: + query: dict[str, object] = {} + if agent is not None: + query["agent"] = agent + return self._http.request("/api/v1/agent_skills", query=query) + + def create(self, input: AgentSkillCreateInput) -> AgentSkill: + return self._http.request("/api/v1/agent_skills", method="POST", body=input) + + def delete(self, agent_skill: str) -> None: + self._http.request(f"/api/v1/agent_skills/{agent_skill}", method="DELETE") + + def get(self, agent_skill: str) -> AgentSkill: + return self._http.request(f"/api/v1/agent_skills/{agent_skill}") + + def update(self, agent_skill: str, input: AgentSkillUpdateInput) -> AgentSkill: + return self._http.request(f"/api/v1/agent_skills/{agent_skill}", method="PATCH", body=input) + + def activate(self, agent_skill: str) -> AgentSkill: + return self._http.request(f"/api/v1/agent_skills/{agent_skill}/activate", method="POST") + + def deactivate(self, agent_skill: str) -> AgentSkill: + return self._http.request(f"/api/v1/agent_skills/{agent_skill}/deactivate", method="POST") diff --git a/src/archastro/platform/v1/resources/agent_tools.py b/src/archastro/platform/v1/resources/agent_tools.py index 62dc8fd..5b5257e 100644 --- a/src/archastro/platform/v1/resources/agent_tools.py +++ b/src/archastro/platform/v1/resources/agent_tools.py @@ -1,12 +1,12 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: c1d7183a3b8b +# Content hash: b7b22bada688 from __future__ import annotations from typing import TypedDict -from ...runtime.http_client import HttpClient +from ...runtime.http_client import HttpClient, SyncHttpClient from ...types.common import AgentTool, AgentToolListResponse, BuiltinToolCatalogEntry AgentToolUpdateInput = TypedDict( @@ -30,7 +30,7 @@ ) -class AgentToolResource: +class AsyncAgentToolResource: def __init__(self, http: HttpClient): self._http = http @@ -61,3 +61,34 @@ async def activate(self, tool: str) -> AgentTool: async def deactivate(self, tool: str) -> AgentTool: return await self._http.request(f"/api/v1/agent_tools/{tool}/deactivate", method="POST") + + +class AgentToolResource: + def __init__(self, http: SyncHttpClient): + self._http = http + + def list(self, *, agent: str | None = None, kind: str | None = None) -> AgentToolListResponse: + query: dict[str, object] = {} + if agent is not None: + query["agent"] = agent + if kind is not None: + query["kind"] = kind + return self._http.request("/api/v1/agent_tools", query=query) + + def catalog(self) -> list[BuiltinToolCatalogEntry]: + return self._http.request("/api/v1/agent_tools/catalog") + + def delete(self, tool: str) -> None: + self._http.request(f"/api/v1/agent_tools/{tool}", method="DELETE") + + def get(self, tool: str) -> AgentTool: + return self._http.request(f"/api/v1/agent_tools/{tool}") + + def update(self, tool: str, input: AgentToolUpdateInput) -> AgentTool: + return self._http.request(f"/api/v1/agent_tools/{tool}", method="PATCH", body=input) + + def activate(self, tool: str) -> AgentTool: + return self._http.request(f"/api/v1/agent_tools/{tool}/activate", method="POST") + + def deactivate(self, tool: str) -> AgentTool: + return self._http.request(f"/api/v1/agent_tools/{tool}/deactivate", method="POST") diff --git a/src/archastro/platform/v1/resources/agents.py b/src/archastro/platform/v1/resources/agents.py index 76f3831..f7b21c2 100644 --- a/src/archastro/platform/v1/resources/agents.py +++ b/src/archastro/platform/v1/resources/agents.py @@ -1,6 +1,6 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: 153aaf3816a4 +# Content hash: 36cd4542c0d3 from __future__ import annotations @@ -9,7 +9,7 @@ from pydantic import BaseModel -from ...runtime.http_client import HttpClient +from ...runtime.http_client import HttpClient, SyncHttpClient from ...types.common import ( Agent, AgentComputer, @@ -364,7 +364,7 @@ class AgentSearchResponse(BaseModel): data: list[dict[str, object] | dict[str, object]] -class AgentAgentComputerResource: +class AsyncAgentAgentComputerResource: def __init__(self, http: HttpClient): self._http = http @@ -379,7 +379,7 @@ async def create(self, agent: str, input: AgentAgentComputerCreateInput) -> Agen ) -class AgentAgentEnvVarResource: +class AsyncAgentAgentEnvVarResource: def __init__(self, http: HttpClient): self._http = http @@ -394,7 +394,7 @@ async def create(self, agent: str, input: AgentAgentEnvVarCreateInput) -> AgentE ) -class AgentAgentInstallationResource: +class AsyncAgentAgentInstallationResource: def __init__(self, http: HttpClient): self._http = http @@ -412,7 +412,7 @@ async def kinds(self, agent: str) -> InstallationKindListResponse: return await self._http.request(f"/api/v1/agents/{agent}/agent_installations/kinds") -class AgentAgentToolResource: +class AsyncAgentAgentToolResource: def __init__(self, http: HttpClient): self._http = http @@ -430,7 +430,7 @@ async def create(self, agent: str, input: AgentAgentToolCreateInput) -> AgentToo ) -class ScheduleResource: +class AsyncScheduleResource: def __init__(self, http: HttpClient): self._http = http @@ -444,14 +444,14 @@ async def get(self, agent: str, schedule: str) -> AgentSchedule: return await self._http.request(f"/api/v1/agents/{agent}/schedules/{schedule}") -class AgentResource: +class AsyncAgentResource: def __init__(self, http: HttpClient): self._http = http - self.agent_computers = AgentAgentComputerResource(http) - self.agent_env_vars = AgentAgentEnvVarResource(http) - self.agent_installations = AgentAgentInstallationResource(http) - self.agent_tools = AgentAgentToolResource(http) - self.schedules = ScheduleResource(http) + self.agent_computers = AsyncAgentAgentComputerResource(http) + self.agent_env_vars = AsyncAgentAgentEnvVarResource(http) + self.agent_installations = AsyncAgentAgentInstallationResource(http) + self.agent_tools = AsyncAgentAgentToolResource(http) + self.schedules = AsyncScheduleResource(http) async def list( self, @@ -563,3 +563,192 @@ async def upgrade(self, agent: str, input: AgentUpgradeInput) -> AgentUpgradeRes method="POST", body=input, ) + + +class AgentAgentComputerResource: + def __init__(self, http: SyncHttpClient): + self._http = http + + def list(self, agent: str) -> AgentComputerListResponse: + return self._http.request(f"/api/v1/agents/{agent}/agent_computers") + + def create(self, agent: str, input: AgentAgentComputerCreateInput) -> AgentComputer: + return self._http.request( + f"/api/v1/agents/{agent}/agent_computers", + method="POST", + body=input, + ) + + +class AgentAgentEnvVarResource: + def __init__(self, http: SyncHttpClient): + self._http = http + + def list(self, agent: str) -> AgentEnvVarMaskedList: + return self._http.request(f"/api/v1/agents/{agent}/agent_env_vars") + + def create(self, agent: str, input: AgentAgentEnvVarCreateInput) -> AgentEnvVarMasked: + return self._http.request( + f"/api/v1/agents/{agent}/agent_env_vars", + method="POST", + body=input, + ) + + +class AgentAgentInstallationResource: + def __init__(self, http: SyncHttpClient): + self._http = http + + def list(self, agent: str) -> InstallationListResponse: + return self._http.request(f"/api/v1/agents/{agent}/agent_installations") + + def create(self, agent: str, input: AgentAgentInstallationCreateInput) -> Installation: + return self._http.request( + f"/api/v1/agents/{agent}/agent_installations", + method="POST", + body=input, + ) + + def kinds(self, agent: str) -> InstallationKindListResponse: + return self._http.request(f"/api/v1/agents/{agent}/agent_installations/kinds") + + +class AgentAgentToolResource: + def __init__(self, http: SyncHttpClient): + self._http = http + + def list(self, agent: str, *, kind: str | None = None) -> AgentToolListResponse: + query: dict[str, object] = {} + if kind is not None: + query["kind"] = kind + return self._http.request(f"/api/v1/agents/{agent}/agent_tools", query=query) + + def create(self, agent: str, input: AgentAgentToolCreateInput) -> AgentTool: + return self._http.request(f"/api/v1/agents/{agent}/agent_tools", method="POST", body=input) + + +class ScheduleResource: + def __init__(self, http: SyncHttpClient): + self._http = http + + def list(self, agent: str, *, status: str | None = None) -> ScheduleListResponse: + query: dict[str, object] = {} + if status is not None: + query["status"] = status + return self._http.request(f"/api/v1/agents/{agent}/schedules", query=query) + + def get(self, agent: str, schedule: str) -> AgentSchedule: + return self._http.request(f"/api/v1/agents/{agent}/schedules/{schedule}") + + +class AgentResource: + def __init__(self, http: SyncHttpClient): + self._http = http + self.agent_computers = AgentAgentComputerResource(http) + self.agent_env_vars = AgentAgentEnvVarResource(http) + self.agent_installations = AgentAgentInstallationResource(http) + self.agent_tools = AgentAgentToolResource(http) + self.schedules = ScheduleResource(http) + + def list( + self, + *, + page: int | None = None, + page_size: int | None = None, + search: str | None = None, + user: str | None = None, + org_id: str | None = None, + template_config: str | None = None, + ) -> AgentListResponse: + query: dict[str, object] = {} + if page is not None: + query["page"] = page + if page_size is not None: + query["pageSize"] = page_size + if search is not None: + query["search"] = search + if user is not None: + query["user"] = user + if org_id is not None: + query["orgId"] = org_id + if template_config is not None: + query["templateConfig"] = template_config + return self._http.request("/api/v1/agents", query=query) + + def create(self, input: AgentCreateInput) -> AgentCreateResponse: + return self._http.request("/api/v1/agents", method="POST", body=input) + + def delete(self, agent: str) -> None: + self._http.request(f"/api/v1/agents/{agent}", method="DELETE") + + def get(self, agent: str) -> Agent: + return self._http.request(f"/api/v1/agents/{agent}") + + def update(self, agent: str, input: AgentUpdateInput) -> Agent: + return self._http.request(f"/api/v1/agents/{agent}", method="PATCH", body=input) + + def agent_health_actions( + self, + agent: str, + *, + source: list[str] | None = None, + status: list[str] | None = None, + kind: list[str] | None = None, + ) -> HealthActionListResponse: + query: dict[str, object] = {} + if source is not None: + query["source"] = source + if status is not None: + query["status"] = status + if kind is not None: + query["kind"] = kind + return self._http.request(f"/api/v1/agents/{agent}/agent_health_actions", query=query) + + def agent_routines(self, agent: str, input: AgentAgentRoutinesInput) -> AgentRoutine: + return self._http.request( + f"/api/v1/agents/{agent}/agent_routines", + method="POST", + body=input, + ) + + def agent_working_memory( + self, + agent: str, + *, + page: int | None = None, + page_size: int | None = None, + search: str | None = None, + ) -> WorkingMemoryEntryListResponse: + query: dict[str, object] = {} + if page is not None: + query["page"] = page + if page_size is not None: + query["pageSize"] = page_size + if search is not None: + query["search"] = search + return self._http.request(f"/api/v1/agents/{agent}/agent_working_memory", query=query) + + def export(self, agent: str, *, remove_identity: bool | None = None) -> AgentExport: + """ + Export agent as AgentTemplate + Reconstructs an AgentTemplate config from a deployed agent and its sub-resources + (tools, routines, skills, installations). Returns the template plus all dependent + config files (scripts, workflows, skills, schemas) with their raw content for a + fully self-contained export. + """ + query: dict[str, object] = {} + if remove_identity is not None: + query["removeIdentity"] = remove_identity + return self._http.request(f"/api/v1/agents/{agent}/export", query=query) + + def health(self, agent: str) -> AgentHealth: + return self._http.request(f"/api/v1/agents/{agent}/health") + + def search(self, agent: str, input: AgentSearchInput) -> AgentSearchResponse: + return self._http.request(f"/api/v1/agents/{agent}/search", method="POST", body=input) + + def threads(self, agent: str, input: AgentThreadsInput) -> Thread: + return self._http.request(f"/api/v1/agents/{agent}/threads", method="POST", body=input) + + def upgrade(self, agent: str, input: AgentUpgradeInput) -> AgentUpgradeResponse: + return self._http.request(f"/api/v1/agents/{agent}/upgrade", method="POST", body=input) diff --git a/src/archastro/platform/v1/resources/ai.py b/src/archastro/platform/v1/resources/ai.py index 1828133..57dc296 100644 --- a/src/archastro/platform/v1/resources/ai.py +++ b/src/archastro/platform/v1/resources/ai.py @@ -1,6 +1,6 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: cff421614f04 +# Content hash: 903e8159a309 from __future__ import annotations @@ -8,7 +8,7 @@ from pydantic import BaseModel -from ...runtime.http_client import HttpClient +from ...runtime.http_client import HttpClient, SyncHttpClient from ...types.ai import AICompletionResult, AIImageResult @@ -117,7 +117,7 @@ class ImageModelsResponse(BaseModel): data: list[ImageModelsResponseDataItem] # The models -class ChatResource: +class AsyncChatResource: def __init__(self, http: HttpClient): self._http = http @@ -128,7 +128,7 @@ async def models(self) -> ChatModelsResponse: return await self._http.request("/api/v1/ai/chat/models") -class ImageResource: +class AsyncImageResource: def __init__(self, http: HttpClient): self._http = http @@ -142,8 +142,40 @@ async def models(self) -> ImageModelsResponse: return await self._http.request("/api/v1/ai/image/models") -class AiResource: +class AsyncAiResource: def __init__(self, http: HttpClient): + self._http = http + self.chat = AsyncChatResource(http) + self.image = AsyncImageResource(http) + + +class ChatResource: + def __init__(self, http: SyncHttpClient): + self._http = http + + def completions(self, input: ChatCompletionsInput) -> AICompletionResult: + return self._http.request("/api/v1/ai/chat/completions", method="POST", body=input) + + def models(self) -> ChatModelsResponse: + return self._http.request("/api/v1/ai/chat/models") + + +class ImageResource: + def __init__(self, http: SyncHttpClient): + self._http = http + + def edits(self, input: ImageEditsInput) -> AIImageResult: + return self._http.request("/api/v1/ai/image/edits", method="POST", body=input) + + def generations(self, input: ImageGenerationsInput) -> AIImageResult: + return self._http.request("/api/v1/ai/image/generations", method="POST", body=input) + + def models(self) -> ImageModelsResponse: + return self._http.request("/api/v1/ai/image/models") + + +class AiResource: + def __init__(self, http: SyncHttpClient): self._http = http self.chat = ChatResource(http) self.image = ImageResource(http) diff --git a/src/archastro/platform/v1/resources/artifacts.py b/src/archastro/platform/v1/resources/artifacts.py index d088bc2..3c2b05d 100644 --- a/src/archastro/platform/v1/resources/artifacts.py +++ b/src/archastro/platform/v1/resources/artifacts.py @@ -1,12 +1,12 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: 9f86e6a68293 +# Content hash: ee76cab74996 from __future__ import annotations from typing import Required, TypedDict -from ...runtime.http_client import HttpClient +from ...runtime.http_client import HttpClient, SyncHttpClient from ...types.artifacts import Artifact @@ -19,7 +19,7 @@ class ArtifactReplaceInput(TypedDict, total=False): name: str | None # Artifact name -class ArtifactResource: +class AsyncArtifactResource: def __init__(self, http: HttpClient): self._http = http @@ -40,3 +40,26 @@ async def content(self, artifact: str, *, version: int | None = None) -> dict[st if version is not None: query["version"] = version return await self._http.request_raw(f"/api/v1/artifacts/{artifact}/content", query=query) + + +class ArtifactResource: + def __init__(self, http: SyncHttpClient): + self._http = http + + def delete(self, artifact: str) -> None: + self._http.request(f"/api/v1/artifacts/{artifact}", method="DELETE") + + def get(self, artifact: str) -> Artifact: + return self._http.request(f"/api/v1/artifacts/{artifact}") + + def replace(self, artifact: str, input: ArtifactReplaceInput) -> Artifact: + return self._http.request(f"/api/v1/artifacts/{artifact}", method="PUT", body=input) + + def archive(self, artifact: str) -> None: + self._http.request(f"/api/v1/artifacts/{artifact}/archive", method="POST") + + def content(self, artifact: str, *, version: int | None = None) -> dict[str, str]: + query: dict[str, object] = {} + if version is not None: + query["version"] = version + return self._http.request_raw(f"/api/v1/artifacts/{artifact}/content", query=query) diff --git a/src/archastro/platform/v1/resources/automation_runs.py b/src/archastro/platform/v1/resources/automation_runs.py index 97e507e..34b6328 100644 --- a/src/archastro/platform/v1/resources/automation_runs.py +++ b/src/archastro/platform/v1/resources/automation_runs.py @@ -1,14 +1,14 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: 31b54eea8bfc +# Content hash: e59c7fffda95 from __future__ import annotations -from ...runtime.http_client import HttpClient +from ...runtime.http_client import HttpClient, SyncHttpClient from ...types.automations import AutomationRun -class AutomationRunResource: +class AsyncAutomationRunResource: def __init__(self, http: HttpClient): self._http = http @@ -20,3 +20,17 @@ async def get(self, automation_run: str) -> AutomationRun: `type: :invoked`. """ return await self._http.request(f"/api/v1/automation_runs/{automation_run}") + + +class AutomationRunResource: + def __init__(self, http: SyncHttpClient): + self._http = http + + def get(self, automation_run: str) -> AutomationRun: + """ + Get a single invoked automation run + Fetches one run created by an invoked automation. + This public lookup route only returns runs whose parent automation has + `type: :invoked`. + """ + return self._http.request(f"/api/v1/automation_runs/{automation_run}") diff --git a/src/archastro/platform/v1/resources/automations.py b/src/archastro/platform/v1/resources/automations.py index d4a78ea..2602b9a 100644 --- a/src/archastro/platform/v1/resources/automations.py +++ b/src/archastro/platform/v1/resources/automations.py @@ -1,12 +1,12 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: 78b9bb238f59 +# Content hash: ac30c1bc0f19 from __future__ import annotations from typing import TypedDict -from ...runtime.http_client import HttpClient +from ...runtime.http_client import HttpClient, SyncHttpClient from ...types.automations import AutomationRun @@ -15,7 +15,7 @@ class AutomationInvokeInput(TypedDict, total=False): payload: dict[str, object] | None -class AutomationResource: +class AsyncAutomationResource: def __init__(self, http: HttpClient): self._http = http @@ -25,3 +25,15 @@ async def invoke(self, automation: str, input: AutomationInvokeInput) -> Automat method="POST", body=input, ) + + +class AutomationResource: + def __init__(self, http: SyncHttpClient): + self._http = http + + def invoke(self, automation: str, input: AutomationInvokeInput) -> AutomationRun: + return self._http.request( + f"/api/v1/automations/{automation}/invoke", + method="POST", + body=input, + ) diff --git a/src/archastro/platform/v1/resources/bug_reports.py b/src/archastro/platform/v1/resources/bug_reports.py index cfaddaa..c1cedbe 100644 --- a/src/archastro/platform/v1/resources/bug_reports.py +++ b/src/archastro/platform/v1/resources/bug_reports.py @@ -1,12 +1,12 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: 7e1ae383195c +# Content hash: c4d13b3252d0 from __future__ import annotations from typing import Required, TypedDict -from ...runtime.http_client import HttpClient +from ...runtime.http_client import HttpClient, SyncHttpClient from ...types.common import BugReport @@ -17,9 +17,17 @@ class BugReportCreateInput(TypedDict, total=False): description: Required[str] # Freeform report text. 1–10,000 chars after trim. -class BugReportResource: +class AsyncBugReportResource: def __init__(self, http: HttpClient): self._http = http async def create(self, input: BugReportCreateInput) -> BugReport: return await self._http.request("/api/v1/bug_reports", method="POST", body=input) + + +class BugReportResource: + def __init__(self, http: SyncHttpClient): + self._http = http + + def create(self, input: BugReportCreateInput) -> BugReport: + return self._http.request("/api/v1/bug_reports", method="POST", body=input) diff --git a/src/archastro/platform/v1/resources/config.py b/src/archastro/platform/v1/resources/config.py index dc0a204..dc0e460 100644 --- a/src/archastro/platform/v1/resources/config.py +++ b/src/archastro/platform/v1/resources/config.py @@ -1,6 +1,6 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: 33ac05411d94 +# Content hash: 58fa8d52cc0d from __future__ import annotations @@ -9,7 +9,7 @@ from pydantic import BaseModel -from ...runtime.http_client import HttpClient +from ...runtime.http_client import HttpClient, SyncHttpClient from ...types.common import ValidationResult from ...types.config import Config, ConfigFacets, ConfigKindSchema @@ -205,7 +205,7 @@ class ConfigVersionsResponse(BaseModel): versions: list[ConfigVersionsResponseVersionsItem] # List of versions -class KindResource: +class AsyncKindResource: def __init__(self, http: HttpClient): self._http = http @@ -219,7 +219,7 @@ async def schema(self, kind: str) -> ConfigKindSchema: return await self._http.request(f"/api/v1/config/kinds/{kind}/schema") -class SystemResource: +class AsyncSystemResource: def __init__(self, http: HttpClient): self._http = http @@ -259,11 +259,11 @@ async def clone(self, system: str, input: SystemCloneInput) -> Config: ) -class ConfigResource: +class AsyncConfigResource: def __init__(self, http: HttpClient): self._http = http - self.kinds = KindResource(http) - self.system = SystemResource(http) + self.kinds = AsyncKindResource(http) + self.system = AsyncSystemResource(http) async def list( self, @@ -425,3 +425,217 @@ async def versions( if org is not None: query["org"] = org return await self._http.request(f"/api/v1/config/{config}/versions", query=query) + + +class KindResource: + def __init__(self, http: SyncHttpClient): + self._http = http + + def list(self, *, kind: list[str] | None = None) -> KindListResponse: + query: dict[str, object] = {} + if kind is not None: + query["kind"] = kind + return self._http.request("/api/v1/config/kinds", query=query) + + def schema(self, kind: str) -> ConfigKindSchema: + return self._http.request(f"/api/v1/config/kinds/{kind}/schema") + + +class SystemResource: + def __init__(self, http: SyncHttpClient): + self._http = http + + def list( + self, + *, + kind: str | None = None, + kinds: list[str] | None = None, + excluded_path_prefixes: list[str] | None = None, + page: int | None = None, + page_size: int | None = None, + ) -> SystemListResponse: + query: dict[str, object] = {} + if kind is not None: + query["kind"] = kind + if kinds is not None: + query["kinds"] = kinds + if excluded_path_prefixes is not None: + query["excludedPathPrefixes"] = excluded_path_prefixes + if page is not None: + query["page"] = page + if page_size is not None: + query["pageSize"] = page_size + return self._http.request("/api/v1/config/system", query=query) + + def facets(self) -> ConfigFacets: + return self._http.request("/api/v1/config/system/facets") + + def get(self, system: str) -> Config: + return self._http.request(f"/api/v1/config/system/{system}") + + def clone(self, system: str, input: SystemCloneInput) -> Config: + return self._http.request( + f"/api/v1/config/system/{system}/clone", + method="POST", + body=input, + ) + + +class ConfigResource: + def __init__(self, http: SyncHttpClient): + self._http = http + self.kinds = KindResource(http) + self.system = SystemResource(http) + + def list( + self, + *, + team: str | None = None, + user: str | None = None, + agent: str | None = None, + kind: str | None = None, + lookup_key: str | None = None, + path_prefix: str | None = None, + parents: list[str] | None = None, + parent_solutions: list[str] | None = None, + ) -> ConfigListResponse: + query: dict[str, object] = {} + if team is not None: + query["team"] = team + if user is not None: + query["user"] = user + if agent is not None: + query["agent"] = agent + if kind is not None: + query["kind"] = kind + if lookup_key is not None: + query["lookupKey"] = lookup_key + if path_prefix is not None: + query["pathPrefix"] = path_prefix + if parents is not None: + query["parents"] = parents + if parent_solutions is not None: + query["parentSolutions"] = parent_solutions + return self._http.request("/api/v1/config", query=query) + + def create(self, input: ConfigCreateInput) -> Config: + return self._http.request("/api/v1/config", method="POST", body=input) + + def encrypt_secret(self, input: ConfigEncryptSecretInput) -> ConfigEncryptSecretResponse: + return self._http.request("/api/v1/config/encrypt_secret", method="POST", body=input) + + def facets( + self, + *, + app: str | None = None, + team: str | None = None, + user: str | None = None, + org: str | None = None, + ) -> ConfigFacets: + query: dict[str, object] = {} + if app is not None: + query["app"] = app + if team is not None: + query["team"] = team + if user is not None: + query["user"] = user + if org is not None: + query["org"] = org + return self._http.request("/api/v1/config/facets", query=query) + + def validate(self, input: ConfigValidateInput) -> ValidationResult: + return self._http.request("/api/v1/config/validate", method="POST", body=input) + + def delete(self, config: str) -> None: + self._http.request(f"/api/v1/config/{config}", method="DELETE") + + def get( + self, + config: str, + *, + team: str | None = None, + user: str | None = None, + agent: str | None = None, + system: bool | None = None, + org: str | None = None, + ) -> Config: + query: dict[str, object] = {} + if team is not None: + query["team"] = team + if user is not None: + query["user"] = user + if agent is not None: + query["agent"] = agent + if system is not None: + query["system"] = system + if org is not None: + query["org"] = org + return self._http.request(f"/api/v1/config/{config}", query=query) + + def update(self, config: str, input: ConfigUpdateInput) -> Config: + return self._http.request(f"/api/v1/config/{config}", method="PATCH", body=input) + + def archive(self, config: str, input: ConfigArchiveInput) -> Config: + return self._http.request(f"/api/v1/config/{config}/archive", method="POST", body=input) + + def change_owner(self, config: str, input: ConfigChangeOwnerInput) -> Config: + return self._http.request( + f"/api/v1/config/{config}/change_owner", + method="POST", + body=input, + ) + + def content( + self, + config: str, + *, + team: str | None = None, + user: str | None = None, + agent: str | None = None, + system: bool | None = None, + org: str | None = None, + format: str | None = None, + inject_protected_fields: bool | None = None, + ) -> dict[str, str]: + query: dict[str, object] = {} + if team is not None: + query["team"] = team + if user is not None: + query["user"] = user + if agent is not None: + query["agent"] = agent + if system is not None: + query["system"] = system + if org is not None: + query["org"] = org + if format is not None: + query["format"] = format + if inject_protected_fields is not None: + query["injectProtectedFields"] = inject_protected_fields + return self._http.request_raw(f"/api/v1/config/{config}/content", query=query) + + def unarchive(self, config: str, input: ConfigUnarchiveInput) -> Config: + return self._http.request(f"/api/v1/config/{config}/unarchive", method="POST", body=input) + + def versions( + self, + config: str, + *, + team: str | None = None, + user: str | None = None, + agent: str | None = None, + system: bool | None = None, + org: str | None = None, + ) -> ConfigVersionsResponse: + query: dict[str, object] = {} + if team is not None: + query["team"] = team + if user is not None: + query["user"] = user + if agent is not None: + query["agent"] = agent + if system is not None: + query["system"] = system + if org is not None: + query["org"] = org + return self._http.request(f"/api/v1/config/{config}/versions", query=query) diff --git a/src/archastro/platform/v1/resources/custom_objects.py b/src/archastro/platform/v1/resources/custom_objects.py index 2bd206f..f92c2f3 100644 --- a/src/archastro/platform/v1/resources/custom_objects.py +++ b/src/archastro/platform/v1/resources/custom_objects.py @@ -1,6 +1,6 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: 57e95ce7579c +# Content hash: b87f0904cc98 from __future__ import annotations @@ -9,7 +9,7 @@ from pydantic import BaseModel -from ...runtime.http_client import HttpClient +from ...runtime.http_client import HttpClient, SyncHttpClient from ...types.common import CustomObject, CustomObjectListResponse @@ -54,7 +54,7 @@ class CustomObjectReplaceResponse(BaseModel): meta: dict[str, object] | None = None # Version metadata -class CustomObjectResource: +class AsyncCustomObjectResource: def __init__(self, http: HttpClient): self._http = http @@ -114,3 +114,59 @@ async def replace( method="PUT", body=input, ) + + +class CustomObjectResource: + def __init__(self, http: SyncHttpClient): + self._http = http + + def list( + self, + type: str, + *, + row_key: str | None = None, + sort_key: list[str] | None = None, + team: list[str] | None = None, + user: list[str] | None = None, + agent: list[str] | None = None, + org: list[str] | None = None, + query: str | None = None, + page: int | None = None, + page_size: int | None = None, + ) -> CustomObjectListResponse: + query: dict[str, object] = {} + query["type"] = type + if row_key is not None: + query["rowKey"] = row_key + if sort_key is not None: + query["sortKey"] = sort_key + if team is not None: + query["team"] = team + if user is not None: + query["user"] = user + if agent is not None: + query["agent"] = agent + if org is not None: + query["org"] = org + if query is not None: + query["query"] = query + if page is not None: + query["page"] = page + if page_size is not None: + query["pageSize"] = page_size + return self._http.request("/api/v1/custom_objects", query=query) + + def create(self, input: CustomObjectCreateInput) -> CustomObject: + return self._http.request("/api/v1/custom_objects", method="POST", body=input) + + def delete(self, object: str) -> CustomObjectDeleteResponse: + return self._http.request(f"/api/v1/custom_objects/{object}", method="DELETE") + + def get(self, object: str, *, type: str | None = None) -> CustomObject: + query: dict[str, object] = {} + if type is not None: + query["type"] = type + return self._http.request(f"/api/v1/custom_objects/{object}", query=query) + + def replace(self, object: str, input: CustomObjectReplaceInput) -> CustomObjectReplaceResponse: + return self._http.request(f"/api/v1/custom_objects/{object}", method="PUT", body=input) diff --git a/src/archastro/platform/v1/resources/files.py b/src/archastro/platform/v1/resources/files.py index 017eec8..53cac02 100644 --- a/src/archastro/platform/v1/resources/files.py +++ b/src/archastro/platform/v1/resources/files.py @@ -1,13 +1,13 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: b4c7c304481d +# Content hash: 91ffe2981ffb from __future__ import annotations -from ...runtime.http_client import HttpClient +from ...runtime.http_client import HttpClient, SyncHttpClient -class FileResource: +class AsyncFileResource: def __init__(self, http: HttpClient): self._http = http @@ -15,3 +15,13 @@ async def avatar(self, file: str, token: str) -> dict[str, str]: query: dict[str, object] = {} query["token"] = token return await self._http.request_raw(f"/api/v1/files/{file}/avatar", query=query) + + +class FileResource: + def __init__(self, http: SyncHttpClient): + self._http = http + + def avatar(self, file: str, token: str) -> dict[str, str]: + query: dict[str, object] = {} + query["token"] = token + return self._http.request_raw(f"/api/v1/files/{file}/avatar", query=query) diff --git a/src/archastro/platform/v1/resources/installation_sources.py b/src/archastro/platform/v1/resources/installation_sources.py index c73ebe6..348c926 100644 --- a/src/archastro/platform/v1/resources/installation_sources.py +++ b/src/archastro/platform/v1/resources/installation_sources.py @@ -1,15 +1,23 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: 83dbcfed81d9 +# Content hash: 52d2307578de from __future__ import annotations -from ...runtime.http_client import HttpClient +from ...runtime.http_client import HttpClient, SyncHttpClient -class InstallationSourceResource: +class AsyncInstallationSourceResource: def __init__(self, http: HttpClient): self._http = http async def delete(self, source: str) -> None: await self._http.request(f"/api/v1/installation_sources/{source}", method="DELETE") + + +class InstallationSourceResource: + def __init__(self, http: SyncHttpClient): + self._http = http + + def delete(self, source: str) -> None: + self._http.request(f"/api/v1/installation_sources/{source}", method="DELETE") diff --git a/src/archastro/platform/v1/resources/invites.py b/src/archastro/platform/v1/resources/invites.py index bd5df2b..7224ee5 100644 --- a/src/archastro/platform/v1/resources/invites.py +++ b/src/archastro/platform/v1/resources/invites.py @@ -1,12 +1,12 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: aefce4b1e5f1 +# Content hash: 77571f22628e from __future__ import annotations from typing import TypedDict -from ...runtime.http_client import HttpClient +from ...runtime.http_client import HttpClient, SyncHttpClient from ...types.users import UserInvite @@ -14,9 +14,17 @@ class InviteAcceptInput(TypedDict): key: str # Invite key -class InviteResource: +class AsyncInviteResource: def __init__(self, http: HttpClient): self._http = http async def accept(self, input: InviteAcceptInput) -> UserInvite: return await self._http.request("/api/v1/invites/accept", method="POST", body=input) + + +class InviteResource: + def __init__(self, http: SyncHttpClient): + self._http = http + + def accept(self, input: InviteAcceptInput) -> UserInvite: + return self._http.request("/api/v1/invites/accept", method="POST", body=input) diff --git a/src/archastro/platform/v1/resources/knowledge_documents.py b/src/archastro/platform/v1/resources/knowledge_documents.py index da54b90..4130ce0 100644 --- a/src/archastro/platform/v1/resources/knowledge_documents.py +++ b/src/archastro/platform/v1/resources/knowledge_documents.py @@ -1,6 +1,6 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: 30fffcd1cfc7 +# Content hash: af6c9906fadc from __future__ import annotations @@ -8,7 +8,7 @@ from pydantic import BaseModel -from ...runtime.http_client import HttpClient +from ...runtime.http_client import HttpClient, SyncHttpClient from ...types.common import ContextDocument, ContextDocumentContent @@ -37,7 +37,7 @@ class KnowledgeDocumentListResponse(BaseModel): total_pages: int # Total pages -class KnowledgeDocumentResource: +class AsyncKnowledgeDocumentResource: def __init__(self, http: HttpClient): self._http = http @@ -91,3 +91,56 @@ async def content( f"/api/v1/knowledge_documents/{document}/content", query=query, ) + + +class KnowledgeDocumentResource: + def __init__(self, http: SyncHttpClient): + self._http = http + + def list( + self, + *, + page: int | None = None, + page_size: int | None = None, + q: str | None = None, + source: list[str] | None = None, + installation: list[str] | None = None, + agent: list[str] | None = None, + ) -> KnowledgeDocumentListResponse: + query: dict[str, object] = {} + if page is not None: + query["page"] = page + if page_size is not None: + query["pageSize"] = page_size + if q is not None: + query["q"] = q + if source is not None: + query["source"] = source + if installation is not None: + query["installation"] = installation + if agent is not None: + query["agent"] = agent + return self._http.request("/api/v1/knowledge_documents", query=query) + + def delete(self, document: str) -> None: + self._http.request(f"/api/v1/knowledge_documents/{document}", method="DELETE") + + def get(self, document: str) -> ContextDocument: + return self._http.request(f"/api/v1/knowledge_documents/{document}") + + def content( + self, + document: str, + *, + offset: int | None = None, + limit: int | None = None, + unit: str | None = None, + ) -> ContextDocumentContent: + query: dict[str, object] = {} + if offset is not None: + query["offset"] = offset + if limit is not None: + query["limit"] = limit + if unit is not None: + query["unit"] = unit + return self._http.request(f"/api/v1/knowledge_documents/{document}/content", query=query) diff --git a/src/archastro/platform/v1/resources/knowledge_sources.py b/src/archastro/platform/v1/resources/knowledge_sources.py index ddf5ded..7ff0bc6 100644 --- a/src/archastro/platform/v1/resources/knowledge_sources.py +++ b/src/archastro/platform/v1/resources/knowledge_sources.py @@ -1,6 +1,6 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: 1d9e7b93f5dd +# Content hash: 650e84ac0078 from __future__ import annotations @@ -9,7 +9,7 @@ from pydantic import BaseModel -from ...runtime.http_client import HttpClient +from ...runtime.http_client import HttpClient, SyncHttpClient from ...types.common import ContextIngestion, KnowledgeSource, KnowledgeSourceKindListResponse @@ -75,7 +75,7 @@ class KnowledgeSourceListResponse(BaseModel): total_pages: int # Total pages -class KnowledgeSourceKindResource: +class AsyncKnowledgeSourceKindResource: def __init__(self, http: HttpClient): self._http = http @@ -83,10 +83,10 @@ async def list(self) -> KnowledgeSourceKindListResponse: return await self._http.request("/api/v1/knowledge_sources/kinds") -class KnowledgeSourceResource: +class AsyncKnowledgeSourceResource: def __init__(self, http: HttpClient): self._http = http - self.kinds = KnowledgeSourceKindResource(http) + self.kinds = AsyncKnowledgeSourceKindResource(http) async def list( self, @@ -141,3 +141,67 @@ async def ingest(self, source: str, input: KnowledgeSourceIngestInput) -> Contex method="POST", body=input, ) + + +class KnowledgeSourceKindResource: + def __init__(self, http: SyncHttpClient): + self._http = http + + def list(self) -> KnowledgeSourceKindListResponse: + return self._http.request("/api/v1/knowledge_sources/kinds") + + +class KnowledgeSourceResource: + def __init__(self, http: SyncHttpClient): + self._http = http + self.kinds = KnowledgeSourceKindResource(http) + + def list( + self, + *, + page: int | None = None, + page_size: int | None = None, + search: str | None = None, + type: str | None = None, + installation: str | None = None, + agent: str | None = None, + org: str | None = None, + owner_scope: Literal["any", "individual", "system"] | None = None, + ) -> KnowledgeSourceListResponse: + query: dict[str, object] = {} + if page is not None: + query["page"] = page + if page_size is not None: + query["pageSize"] = page_size + if search is not None: + query["search"] = search + if type is not None: + query["type"] = type + if installation is not None: + query["installation"] = installation + if agent is not None: + query["agent"] = agent + if org is not None: + query["org"] = org + if owner_scope is not None: + query["ownerScope"] = owner_scope + return self._http.request("/api/v1/knowledge_sources", query=query) + + def create(self, input: KnowledgeSourceCreateInput) -> KnowledgeSource: + return self._http.request("/api/v1/knowledge_sources", method="POST", body=input) + + def delete(self, source: str) -> None: + self._http.request(f"/api/v1/knowledge_sources/{source}", method="DELETE") + + def get(self, source: str) -> KnowledgeSource: + return self._http.request(f"/api/v1/knowledge_sources/{source}") + + def update(self, source: str, input: KnowledgeSourceUpdateInput) -> KnowledgeSource: + return self._http.request(f"/api/v1/knowledge_sources/{source}", method="PATCH", body=input) + + def ingest(self, source: str, input: KnowledgeSourceIngestInput) -> ContextIngestion: + return self._http.request( + f"/api/v1/knowledge_sources/{source}/ingest", + method="POST", + body=input, + ) diff --git a/src/archastro/platform/v1/resources/kv.py b/src/archastro/platform/v1/resources/kv.py index a1c4f58..0efee9e 100644 --- a/src/archastro/platform/v1/resources/kv.py +++ b/src/archastro/platform/v1/resources/kv.py @@ -1,12 +1,12 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: 9d8e4c8db1c6 +# Content hash: 5c8646b51098 from __future__ import annotations from typing import Required, TypedDict -from ...runtime.http_client import HttpClient +from ...runtime.http_client import HttpClient, SyncHttpClient from ...types.common import KeyValueStorageEntry, KeyValueStorageEntryPage @@ -21,7 +21,7 @@ class KvUpsertInput(TypedDict, total=False): value: Required[str] # Value to store -class KvResource: +class AsyncKvResource: def __init__(self, http: HttpClient): self._http = http @@ -61,3 +61,45 @@ async def get(self, key: str, *, user: str | None = None) -> KeyValueStorageEntr async def upsert(self, key: str, input: KvUpsertInput) -> KeyValueStorageEntry: return await self._http.request(f"/api/v1/kv/{key}", method="PUT", body=input) + + +class KvResource: + def __init__(self, http: SyncHttpClient): + self._http = http + + def list( + self, + *, + page: int | None = None, + page_size: int | None = None, + user: str | None = None, + user_search: str | None = None, + key: str | None = None, + ) -> KeyValueStorageEntryPage: + query: dict[str, object] = {} + if page is not None: + query["page"] = page + if page_size is not None: + query["pageSize"] = page_size + if user is not None: + query["user"] = user + if user_search is not None: + query["userSearch"] = user_search + if key is not None: + query["key"] = key + return self._http.request("/api/v1/kv", query=query) + + def create(self, input: KvCreateInput) -> KeyValueStorageEntry: + return self._http.request("/api/v1/kv", method="POST", body=input) + + def delete(self, key: str) -> None: + self._http.request(f"/api/v1/kv/{key}", method="DELETE") + + def get(self, key: str, *, user: str | None = None) -> KeyValueStorageEntry: + query: dict[str, object] = {} + if user is not None: + query["user"] = user + return self._http.request(f"/api/v1/kv/{key}", query=query) + + def upsert(self, key: str, input: KvUpsertInput) -> KeyValueStorageEntry: + return self._http.request(f"/api/v1/kv/{key}", method="PUT", body=input) diff --git a/src/archastro/platform/v1/resources/notification_preferences.py b/src/archastro/platform/v1/resources/notification_preferences.py index f9d1a21..73fcb8a 100644 --- a/src/archastro/platform/v1/resources/notification_preferences.py +++ b/src/archastro/platform/v1/resources/notification_preferences.py @@ -1,12 +1,12 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: b41360602174 +# Content hash: 55e88ccadc03 from __future__ import annotations from typing import Required, TypedDict -from ...runtime.http_client import HttpClient +from ...runtime.http_client import HttpClient, SyncHttpClient from ...types.notifications import NotificationPreference, NotificationPreferenceList @@ -17,7 +17,7 @@ class NotificationPreferenceReplaceInput(TypedDict, total=False): type: Required[str] -class NotificationPreferenceResource: +class AsyncNotificationPreferenceResource: def __init__(self, http: HttpClient): self._http = http @@ -33,3 +33,17 @@ async def replace(self, input: NotificationPreferenceReplaceInput) -> Notificati method="PUT", body=input, ) + + +class NotificationPreferenceResource: + def __init__(self, http: SyncHttpClient): + self._http = http + + def remove(self) -> None: + self._http.request("/api/v1/notification_preferences", method="DELETE") + + def list(self) -> NotificationPreferenceList: + return self._http.request("/api/v1/notification_preferences") + + def replace(self, input: NotificationPreferenceReplaceInput) -> NotificationPreference: + return self._http.request("/api/v1/notification_preferences", method="PUT", body=input) diff --git a/src/archastro/platform/v1/resources/notifications.py b/src/archastro/platform/v1/resources/notifications.py index 69a618f..bb006ee 100644 --- a/src/archastro/platform/v1/resources/notifications.py +++ b/src/archastro/platform/v1/resources/notifications.py @@ -1,6 +1,6 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: 5066728c62fb +# Content hash: f05267c2488a from __future__ import annotations @@ -9,7 +9,7 @@ from pydantic import BaseModel -from ...runtime.http_client import HttpClient +from ...runtime.http_client import HttpClient, SyncHttpClient from ...types.notifications import Notification @@ -41,7 +41,7 @@ class NotificationUnreadCountResponse(BaseModel): count: int # Number of unread notifications -class NotificationResource: +class AsyncNotificationResource: def __init__(self, http: HttpClient): self._http = http @@ -78,3 +78,42 @@ async def read(self, notification: str) -> None: async def unarchive(self, notification: str) -> None: await self._http.request(f"/api/v1/notifications/{notification}/unarchive", method="POST") + + +class NotificationResource: + def __init__(self, http: SyncHttpClient): + self._http = http + + def list( + self, + *, + status: str | None = None, + limit: int | None = None, + after_cursor: str | None = None, + ) -> NotificationListResponse: + query: dict[str, object] = {} + if status is not None: + query["status"] = status + if limit is not None: + query["limit"] = limit + if after_cursor is not None: + query["afterCursor"] = after_cursor + return self._http.request("/api/v1/notifications", query=query) + + def read_all(self) -> None: + self._http.request("/api/v1/notifications/read_all", method="POST") + + def send(self, input: NotificationSendInput) -> Notification: + return self._http.request("/api/v1/notifications/send", method="POST", body=input) + + def unread_count(self) -> NotificationUnreadCountResponse: + return self._http.request("/api/v1/notifications/unread_count") + + def archive(self, notification: str) -> None: + self._http.request(f"/api/v1/notifications/{notification}/archive", method="POST") + + def read(self, notification: str) -> None: + self._http.request(f"/api/v1/notifications/{notification}/read", method="POST") + + def unarchive(self, notification: str) -> None: + self._http.request(f"/api/v1/notifications/{notification}/unarchive", method="POST") diff --git a/src/archastro/platform/v1/resources/orgs.py b/src/archastro/platform/v1/resources/orgs.py index f54fbcd..5270008 100644 --- a/src/archastro/platform/v1/resources/orgs.py +++ b/src/archastro/platform/v1/resources/orgs.py @@ -1,12 +1,12 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: 29a357bc6f84 +# Content hash: beb8ce42c047 from __future__ import annotations from pydantic import BaseModel -from ...runtime.http_client import HttpClient +from ...runtime.http_client import HttpClient, SyncHttpClient class OrgListResponseDataItem(BaseModel): @@ -25,7 +25,7 @@ class OrgListResponse(BaseModel): total_pages: int | None = None # Total pages -class OrgResource: +class AsyncOrgResource: def __init__(self, http: HttpClient): self._http = http @@ -40,3 +40,20 @@ async def list( if page_size is not None: query["pageSize"] = page_size return await self._http.request("/api/v1/orgs", query=query) + + +class OrgResource: + def __init__(self, http: SyncHttpClient): + self._http = http + + def list( + self, *, search: str | None = None, page: int | None = None, page_size: int | None = None + ) -> OrgListResponse: + query: dict[str, object] = {} + if search is not None: + query["search"] = search + if page is not None: + query["page"] = page + if page_size is not None: + query["pageSize"] = page_size + return self._http.request("/api/v1/orgs", query=query) diff --git a/src/archastro/platform/v1/resources/solution_categories.py b/src/archastro/platform/v1/resources/solution_categories.py index 93ba19c..d9e6498 100644 --- a/src/archastro/platform/v1/resources/solution_categories.py +++ b/src/archastro/platform/v1/resources/solution_categories.py @@ -1,14 +1,14 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: 8daa242adc9f +# Content hash: 1ce3a37dd7fd from __future__ import annotations -from ...runtime.http_client import HttpClient +from ...runtime.http_client import HttpClient, SyncHttpClient from ...types.common import SolutionCategoryListResponse -class SolutionCategoryResource: +class AsyncSolutionCategoryResource: def __init__(self, http: HttpClient): self._http = http @@ -39,3 +39,36 @@ async def list( if owners is not None: query["owners"] = owners return await self._http.request("/api/v1/solution_categories", query=query) + + +class SolutionCategoryResource: + def __init__(self, http: SyncHttpClient): + self._http = http + + def list( + self, + *, + page: int | None = None, + page_size: int | None = None, + keys: list[str] | None = None, + parent_keys: list[str] | None = None, + lookup_key: str | None = None, + path_prefix: str | None = None, + owners: list[str] | None = None, + ) -> SolutionCategoryListResponse: + query: dict[str, object] = {} + if page is not None: + query["page"] = page + if page_size is not None: + query["pageSize"] = page_size + if keys is not None: + query["keys"] = keys + if parent_keys is not None: + query["parentKeys"] = parent_keys + if lookup_key is not None: + query["lookupKey"] = lookup_key + if path_prefix is not None: + query["pathPrefix"] = path_prefix + if owners is not None: + query["owners"] = owners + return self._http.request("/api/v1/solution_categories", query=query) diff --git a/src/archastro/platform/v1/resources/solution_tags.py b/src/archastro/platform/v1/resources/solution_tags.py index a5b01d4..9aab84c 100644 --- a/src/archastro/platform/v1/resources/solution_tags.py +++ b/src/archastro/platform/v1/resources/solution_tags.py @@ -1,14 +1,14 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: 83ef33e1c229 +# Content hash: c778b6248620 from __future__ import annotations -from ...runtime.http_client import HttpClient +from ...runtime.http_client import HttpClient, SyncHttpClient from ...types.common import SolutionTagListResponse -class SolutionTagResource: +class AsyncSolutionTagResource: def __init__(self, http: HttpClient): self._http = http @@ -36,3 +36,33 @@ async def list( if owners is not None: query["owners"] = owners return await self._http.request("/api/v1/solution_tags", query=query) + + +class SolutionTagResource: + def __init__(self, http: SyncHttpClient): + self._http = http + + def list( + self, + *, + page: int | None = None, + page_size: int | None = None, + keys: list[str] | None = None, + lookup_key: str | None = None, + path_prefix: str | None = None, + owners: list[str] | None = None, + ) -> SolutionTagListResponse: + query: dict[str, object] = {} + if page is not None: + query["page"] = page + if page_size is not None: + query["pageSize"] = page_size + if keys is not None: + query["keys"] = keys + if lookup_key is not None: + query["lookupKey"] = lookup_key + if path_prefix is not None: + query["pathPrefix"] = path_prefix + if owners is not None: + query["owners"] = owners + return self._http.request("/api/v1/solution_tags", query=query) diff --git a/src/archastro/platform/v1/resources/solutions.py b/src/archastro/platform/v1/resources/solutions.py index 76dbf42..452a1f2 100644 --- a/src/archastro/platform/v1/resources/solutions.py +++ b/src/archastro/platform/v1/resources/solutions.py @@ -1,12 +1,12 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: b60fc17a5066 +# Content hash: 12375cdaef77 from __future__ import annotations from typing import Required, TypedDict -from ...runtime.http_client import HttpClient +from ...runtime.http_client import HttpClient, SyncHttpClient from ...types.common import ( SolutionDependentsResponse, SolutionImportResponse, @@ -182,7 +182,7 @@ class SolutionUpgradeInput(TypedDict, total=False): target_solution: str | None -class SolutionResource: +class AsyncSolutionResource: def __init__(self, http: HttpClient): self._http = http @@ -240,3 +240,63 @@ async def upgrade(self, solution: str, input: SolutionUpgradeInput) -> SolutionU method="POST", body=input, ) + + +class SolutionResource: + def __init__(self, http: SyncHttpClient): + self._http = http + + def list( + self, + *, + page: int | None = None, + page_size: int | None = None, + lookup_key: str | None = None, + path_prefix: str | None = None, + owners: list[str] | None = None, + ) -> SolutionListResponse: + query: dict[str, object] = {} + if page is not None: + query["page"] = page + if page_size is not None: + query["pageSize"] = page_size + if lookup_key is not None: + query["lookupKey"] = lookup_key + if path_prefix is not None: + query["pathPrefix"] = path_prefix + if owners is not None: + query["owners"] = owners + return self._http.request("/api/v1/solutions", query=query) + + def create(self, input: SolutionCreateInput) -> SolutionImportResponse: + return self._http.request("/api/v1/solutions", method="POST", body=input) + + def delete(self, solution: str) -> None: + self._http.request(f"/api/v1/solutions/{solution}", method="DELETE") + + def get(self, solution: str) -> SolutionSummary: + return self._http.request(f"/api/v1/solutions/{solution}") + + def dependents(self, solution: str) -> SolutionDependentsResponse: + return self._http.request(f"/api/v1/solutions/{solution}/dependents") + + def install(self, solution: str, input: SolutionInstallInput) -> SolutionInstallResponse: + return self._http.request( + f"/api/v1/solutions/{solution}/install", + method="POST", + body=input, + ) + + def readme(self, solution: str, token: str, *, file: str | None = None) -> dict[str, str]: + query: dict[str, object] = {} + query["token"] = token + if file is not None: + query["file"] = file + return self._http.request_raw(f"/api/v1/solutions/{solution}/readme", query=query) + + def upgrade(self, solution: str, input: SolutionUpgradeInput) -> SolutionUpgradeResponse: + return self._http.request( + f"/api/v1/solutions/{solution}/upgrade", + method="POST", + body=input, + ) diff --git a/src/archastro/platform/v1/resources/team_memberships.py b/src/archastro/platform/v1/resources/team_memberships.py index b8a5473..22336bf 100644 --- a/src/archastro/platform/v1/resources/team_memberships.py +++ b/src/archastro/platform/v1/resources/team_memberships.py @@ -1,14 +1,14 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: fd3c348f5835 +# Content hash: baf16dd265b4 from __future__ import annotations -from ...runtime.http_client import HttpClient +from ...runtime.http_client import HttpClient, SyncHttpClient from ...types.teams import TeamMembershipListResponse -class TeamMembershipResource: +class AsyncTeamMembershipResource: def __init__(self, http: HttpClient): self._http = http @@ -36,3 +36,33 @@ async def list( async def delete(self, team_membership: str) -> None: await self._http.request(f"/api/v1/team_memberships/{team_membership}", method="DELETE") + + +class TeamMembershipResource: + def __init__(self, http: SyncHttpClient): + self._http = http + + def list( + self, + *, + team: list[str] | None = None, + user: list[str] | None = None, + agent: list[str] | None = None, + page: int | None = None, + page_size: int | None = None, + ) -> TeamMembershipListResponse: + query: dict[str, object] = {} + if team is not None: + query["team"] = team + if user is not None: + query["user"] = user + if agent is not None: + query["agent"] = agent + if page is not None: + query["page"] = page + if page_size is not None: + query["pageSize"] = page_size + return self._http.request("/api/v1/team_memberships", query=query) + + def delete(self, team_membership: str) -> None: + self._http.request(f"/api/v1/team_memberships/{team_membership}", method="DELETE") diff --git a/src/archastro/platform/v1/resources/teams.py b/src/archastro/platform/v1/resources/teams.py index 6766b76..310e11e 100644 --- a/src/archastro/platform/v1/resources/teams.py +++ b/src/archastro/platform/v1/resources/teams.py @@ -1,6 +1,6 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: 7c99becc1f94 +# Content hash: a814dd81d212 from __future__ import annotations @@ -9,7 +9,7 @@ from pydantic import BaseModel -from ...runtime.http_client import HttpClient +from ...runtime.http_client import HttpClient, SyncHttpClient from ...types.artifacts import Artifact from ...types.common import CustomObject from ...types.teams import Team, TeamInvite, TeamMembership @@ -561,7 +561,7 @@ class TeamInvitesResponse(BaseModel): code: str # 6-character join code -class TeamArtifactResource: +class AsyncTeamArtifactResource: def __init__(self, http: HttpClient): self._http = http @@ -576,7 +576,7 @@ async def create(self, team: str, input: TeamArtifactCreateInput) -> Artifact: ) -class TeamCustomObjectResource: +class AsyncTeamCustomObjectResource: def __init__(self, http: HttpClient): self._http = http @@ -613,7 +613,7 @@ async def create(self, team: str, input: TeamCustomObjectCreateInput) -> CustomO ) -class MemberResource: +class AsyncMemberResource: def __init__(self, http: HttpClient): self._http = http @@ -634,7 +634,7 @@ async def update(self, team: str, user: str, input: MemberUpdateInput) -> TeamMe ) -class TeamThreadResource: +class AsyncTeamThreadResource: def __init__(self, http: HttpClient): self._http = http @@ -645,13 +645,13 @@ async def create(self, team: str, input: TeamThreadCreateInput) -> Thread: return await self._http.request(f"/api/v1/teams/{team}/threads", method="POST", body=input) -class TeamResource: +class AsyncTeamResource: def __init__(self, http: HttpClient): self._http = http - self.artifacts = TeamArtifactResource(http) - self.custom_objects = TeamCustomObjectResource(http) - self.members = MemberResource(http) - self.threads = TeamThreadResource(http) + self.artifacts = AsyncTeamArtifactResource(http) + self.custom_objects = AsyncTeamCustomObjectResource(http) + self.members = AsyncMemberResource(http) + self.threads = AsyncTeamThreadResource(http) async def list( self, @@ -717,3 +717,153 @@ async def join(self, team: str, input: TeamJoinInput) -> None: async def leave(self, team: str) -> None: await self._http.request(f"/api/v1/teams/{team}/leave", method="DELETE") + + +class TeamArtifactResource: + def __init__(self, http: SyncHttpClient): + self._http = http + + def list(self, team: str) -> TeamArtifactListResponse: + return self._http.request(f"/api/v1/teams/{team}/artifacts") + + def create(self, team: str, input: TeamArtifactCreateInput) -> Artifact: + return self._http.request(f"/api/v1/teams/{team}/artifacts", method="POST", body=input) + + +class TeamCustomObjectResource: + def __init__(self, http: SyncHttpClient): + self._http = http + + def list( + self, + team: str, + type: str, + *, + limit: int | None = None, + offset: int | None = None, + row_key: str | None = None, + sort_key: str | None = None, + query: str | None = None, + ) -> TeamCustomObjectListResponse: + query: dict[str, object] = {} + query["type"] = type + if limit is not None: + query["limit"] = limit + if offset is not None: + query["offset"] = offset + if row_key is not None: + query["rowKey"] = row_key + if sort_key is not None: + query["sortKey"] = sort_key + if query is not None: + query["query"] = query + return self._http.request(f"/api/v1/teams/{team}/custom_objects", query=query) + + def create(self, team: str, input: TeamCustomObjectCreateInput) -> CustomObject: + return self._http.request(f"/api/v1/teams/{team}/custom_objects", method="POST", body=input) + + +class MemberResource: + def __init__(self, http: SyncHttpClient): + self._http = http + + def remove(self, team: str) -> None: + self._http.request(f"/api/v1/teams/{team}/members", method="DELETE") + + def list(self, team: str) -> MemberListResponse: + return self._http.request(f"/api/v1/teams/{team}/members") + + def create(self, team: str, input: MemberCreateInput) -> TeamMembership: + return self._http.request(f"/api/v1/teams/{team}/members", method="POST", body=input) + + def update(self, team: str, user: str, input: MemberUpdateInput) -> TeamMembership: + return self._http.request( + f"/api/v1/teams/{team}/members/{user}", + method="PATCH", + body=input, + ) + + +class TeamThreadResource: + def __init__(self, http: SyncHttpClient): + self._http = http + + def list(self, team: str) -> TeamThreadListResponse: + return self._http.request(f"/api/v1/teams/{team}/threads") + + def create(self, team: str, input: TeamThreadCreateInput) -> Thread: + return self._http.request(f"/api/v1/teams/{team}/threads", method="POST", body=input) + + +class TeamResource: + def __init__(self, http: SyncHttpClient): + self._http = http + self.artifacts = TeamArtifactResource(http) + self.custom_objects = TeamCustomObjectResource(http) + self.members = MemberResource(http) + self.threads = TeamThreadResource(http) + + def list( + self, + *, + page: int | None = None, + page_size: int | None = None, + search: str | None = None, + metadata: dict[str, object] | None = None, + membership: str | None = None, + ) -> TeamListResponse: + query: dict[str, object] = {} + if page is not None: + query["page"] = page + if page_size is not None: + query["pageSize"] = page_size + if search is not None: + query["search"] = search + if metadata is not None: + query["metadata"] = metadata + if membership is not None: + query["membership"] = membership + return self._http.request("/api/v1/teams", query=query) + + def create(self, input: TeamCreateInput) -> Team: + return self._http.request("/api/v1/teams", method="POST", body=input) + + def join_by_code(self, input: TeamJoinByCodeInput) -> Team: + """ + Join a team using an invite code + Accepts either `join_code` or `invite_code`. + For user-authenticated requests, the current user joins the team identified by + the invite code. For server-to-server requests, provide `agent` or `user` to + add that principal to the team instead. + """ + return self._http.request("/api/v1/teams/join_by_code", method="POST", body=input) + + def delete(self, team: str) -> None: + self._http.request(f"/api/v1/teams/{team}", method="DELETE") + + def get(self, team: str) -> Team: + return self._http.request(f"/api/v1/teams/{team}") + + def update(self, team: str, input: TeamUpdateInput) -> Team: + return self._http.request(f"/api/v1/teams/{team}", method="PATCH", body=input) + + def invite(self, team: str) -> TeamInvite: + return self._http.request(f"/api/v1/teams/{team}/invite", method="POST") + + def invites(self, team: str) -> TeamInvitesResponse: + return self._http.request(f"/api/v1/teams/{team}/invites", method="POST") + + def join(self, team: str, input: TeamJoinInput) -> None: + """ + Join a team the current user can see + Joins a specific visible team by team ID. + For standard user requests, the current user is added to the team. When + `agent` is provided, the current user must already be a team member and the + agent is added instead. When `user` is provided, the current user must be + able to manage the team (owner / team admin / org admin) and the named user, + who must belong to the caller's own org, is added as a member. + """ + self._http.request(f"/api/v1/teams/{team}/join", method="POST", body=input) + + def leave(self, team: str) -> None: + self._http.request(f"/api/v1/teams/{team}/leave", method="DELETE") diff --git a/src/archastro/platform/v1/resources/thread_messages.py b/src/archastro/platform/v1/resources/thread_messages.py index 9608655..62ea385 100644 --- a/src/archastro/platform/v1/resources/thread_messages.py +++ b/src/archastro/platform/v1/resources/thread_messages.py @@ -1,6 +1,6 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: ce84bb76d7b8 +# Content hash: 6b4b4bc470d0 from __future__ import annotations @@ -9,7 +9,7 @@ from pydantic import BaseModel -from ...runtime.http_client import HttpClient +from ...runtime.http_client import HttpClient, SyncHttpClient from ...types.common import Message, PaginatedReplies @@ -35,7 +35,7 @@ class ReactionCreateResponse(BaseModel): data: ReactionCreateResponseData # The created reaction -class ReactionResource: +class AsyncReactionResource: def __init__(self, http: HttpClient): self._http = http @@ -50,10 +50,10 @@ async def create(self, message: str, input: ReactionCreateInput) -> ReactionCrea ) -class ThreadMessageResource: +class AsyncThreadMessageResource: def __init__(self, http: HttpClient): self._http = http - self.reactions = ReactionResource(http) + self.reactions = AsyncReactionResource(http) async def delete(self, message: str) -> None: await self._http.request(f"/api/v1/thread_messages/{message}", method="DELETE") @@ -84,3 +84,50 @@ async def replies( if tree is not None: query["tree"] = tree return await self._http.request(f"/api/v1/thread_messages/{message}/replies", query=query) + + +class ReactionResource: + def __init__(self, http: SyncHttpClient): + self._http = http + + def remove(self, message: str) -> None: + self._http.request(f"/api/v1/thread_messages/{message}/reactions", method="DELETE") + + def create(self, message: str, input: ReactionCreateInput) -> ReactionCreateResponse: + return self._http.request( + f"/api/v1/thread_messages/{message}/reactions", + method="POST", + body=input, + ) + + +class ThreadMessageResource: + def __init__(self, http: SyncHttpClient): + self._http = http + self.reactions = ReactionResource(http) + + def delete(self, message: str) -> None: + self._http.request(f"/api/v1/thread_messages/{message}", method="DELETE") + + def replace(self, message: str, input: ThreadMessageReplaceInput) -> Message: + return self._http.request(f"/api/v1/thread_messages/{message}", method="PUT", body=input) + + def replies( + self, + message: str, + *, + before_cursor: str | None = None, + after_cursor: str | None = None, + limit: int | None = None, + tree: bool | None = None, + ) -> PaginatedReplies: + query: dict[str, object] = {} + if before_cursor is not None: + query["beforeCursor"] = before_cursor + if after_cursor is not None: + query["afterCursor"] = after_cursor + if limit is not None: + query["limit"] = limit + if tree is not None: + query["tree"] = tree + return self._http.request(f"/api/v1/thread_messages/{message}/replies", query=query) diff --git a/src/archastro/platform/v1/resources/threads.py b/src/archastro/platform/v1/resources/threads.py index f207e7a..831cd35 100644 --- a/src/archastro/platform/v1/resources/threads.py +++ b/src/archastro/platform/v1/resources/threads.py @@ -1,6 +1,6 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: 0ea3726308dd +# Content hash: 0dfcebd9509d from __future__ import annotations @@ -9,7 +9,7 @@ from pydantic import BaseModel -from ...runtime.http_client import HttpClient +from ...runtime.http_client import HttpClient, SyncHttpClient from ...types.threads import Thread, ThreadMember, ThreadReadStatus, ThreadSettings @@ -239,7 +239,7 @@ class ThreadSearchResponse(BaseModel): data: list[dict[str, object]] # Matching context items (tagged objects) -class ThreadMemberResource: +class AsyncThreadMemberResource: def __init__(self, http: HttpClient): self._http = http @@ -257,7 +257,7 @@ async def create(self, thread: str, input: ThreadMemberCreateInput) -> ThreadMem ) -class SettingResource: +class AsyncSettingResource: def __init__(self, http: HttpClient): self._http = http @@ -272,11 +272,11 @@ async def replace(self, thread: str, input: SettingReplaceInput) -> ThreadSettin ) -class ThreadResource: +class AsyncThreadResource: def __init__(self, http: HttpClient): self._http = http - self.members = ThreadMemberResource(http) - self.settings = SettingResource(http) + self.members = AsyncThreadMemberResource(http) + self.settings = AsyncSettingResource(http) async def delete(self, thread: str) -> None: await self._http.request(f"/api/v1/threads/{thread}", method="DELETE") @@ -335,3 +335,89 @@ async def search(self, thread: str, q: str, *, type: str | None = None) -> Threa if type is not None: query["type"] = type return await self._http.request(f"/api/v1/threads/{thread}/search", query=query) + + +class ThreadMemberResource: + def __init__(self, http: SyncHttpClient): + self._http = http + + def remove(self, thread: str) -> None: + self._http.request(f"/api/v1/threads/{thread}/members", method="DELETE") + + def list(self, thread: str) -> ThreadMemberListResponse: + return self._http.request(f"/api/v1/threads/{thread}/members") + + def create(self, thread: str, input: ThreadMemberCreateInput) -> ThreadMember: + return self._http.request(f"/api/v1/threads/{thread}/members", method="POST", body=input) + + +class SettingResource: + def __init__(self, http: SyncHttpClient): + self._http = http + + def list(self, thread: str) -> SettingListResponse: + return self._http.request(f"/api/v1/threads/{thread}/settings") + + def replace(self, thread: str, input: SettingReplaceInput) -> ThreadSettings: + return self._http.request(f"/api/v1/threads/{thread}/settings", method="PUT", body=input) + + +class ThreadResource: + def __init__(self, http: SyncHttpClient): + self._http = http + self.members = ThreadMemberResource(http) + self.settings = SettingResource(http) + + def delete(self, thread: str) -> None: + self._http.request(f"/api/v1/threads/{thread}", method="DELETE") + + def get(self, thread: str) -> Thread: + return self._http.request(f"/api/v1/threads/{thread}") + + def replace(self, thread: str, input: ThreadReplaceInput) -> Thread: + return self._http.request(f"/api/v1/threads/{thread}", method="PUT", body=input) + + def agents(self, thread: str) -> ThreadAgentsResponse: + return self._http.request(f"/api/v1/threads/{thread}/agents") + + def artifacts(self, thread: str) -> ThreadArtifactsResponse: + return self._http.request(f"/api/v1/threads/{thread}/artifacts") + + def mark_read(self, thread: str, input: ThreadMarkReadInput) -> None: + self._http.request(f"/api/v1/threads/{thread}/mark_read", method="POST", body=input) + + def messages( + self, + thread: str, + *, + before_cursor: str | None = None, + after_cursor: str | None = None, + limit: int | None = None, + include_reply_counts: bool | None = None, + ) -> ThreadMessagesResponse: + query: dict[str, object] = {} + if before_cursor is not None: + query["beforeCursor"] = before_cursor + if after_cursor is not None: + query["afterCursor"] = after_cursor + if limit is not None: + query["limit"] = limit + if include_reply_counts is not None: + query["includeReplyCounts"] = include_reply_counts + return self._http.request(f"/api/v1/threads/{thread}/messages", query=query) + + def picture(self, thread: str, input: ThreadPictureInput) -> Thread: + return self._http.request(f"/api/v1/threads/{thread}/picture", method="PUT", body=input) + + def read_status(self, thread: str, *, user: str | None = None) -> ThreadReadStatus: + query: dict[str, object] = {} + if user is not None: + query["user"] = user + return self._http.request(f"/api/v1/threads/{thread}/read_status", query=query) + + def search(self, thread: str, q: str, *, type: str | None = None) -> ThreadSearchResponse: + query: dict[str, object] = {} + query["q"] = q + if type is not None: + query["type"] = type + return self._http.request(f"/api/v1/threads/{thread}/search", query=query) diff --git a/src/archastro/platform/v1/resources/users.py b/src/archastro/platform/v1/resources/users.py index abf0560..2139326 100644 --- a/src/archastro/platform/v1/resources/users.py +++ b/src/archastro/platform/v1/resources/users.py @@ -1,6 +1,6 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: 68fd55cb6b22 +# Content hash: 0c44ddb99e15 from __future__ import annotations @@ -9,7 +9,7 @@ from pydantic import BaseModel -from ...runtime.http_client import HttpClient +from ...runtime.http_client import HttpClient, SyncHttpClient from ...types.artifacts import Artifact from ...types.threads import Thread from ...types.users import User, UserInvite @@ -346,7 +346,7 @@ class UserOrgsResponse(BaseModel): data: list[UserOrgsResponseDataItem] # Organization list -class UserArtifactResource: +class AsyncUserArtifactResource: def __init__(self, http: HttpClient): self._http = http @@ -361,7 +361,7 @@ async def create(self, user: str, input: UserArtifactCreateInput) -> Artifact: ) -class UserThreadResource: +class AsyncUserThreadResource: def __init__(self, http: HttpClient): self._http = http @@ -383,11 +383,11 @@ async def create(self, user: str, input: UserThreadCreateInput) -> Thread: return await self._http.request(f"/api/v1/users/{user}/threads", method="POST", body=input) -class UserResource: +class AsyncUserResource: def __init__(self, http: HttpClient): self._http = http - self.artifacts = UserArtifactResource(http) - self.threads = UserThreadResource(http) + self.artifacts = AsyncUserArtifactResource(http) + self.threads = AsyncUserThreadResource(http) async def me(self) -> User: return await self._http.request("/api/v1/users/me") @@ -403,3 +403,58 @@ async def orgs(self, user: str) -> UserOrgsResponse: async def profile(self, user: str, input: UserProfileInput) -> User: return await self._http.request(f"/api/v1/users/{user}/profile", method="PUT", body=input) + + +class UserArtifactResource: + def __init__(self, http: SyncHttpClient): + self._http = http + + def list(self, user: str) -> UserArtifactListResponse: + return self._http.request(f"/api/v1/users/{user}/artifacts") + + def create(self, user: str, input: UserArtifactCreateInput) -> Artifact: + return self._http.request(f"/api/v1/users/{user}/artifacts", method="POST", body=input) + + +class UserThreadResource: + def __init__(self, http: SyncHttpClient): + self._http = http + + def list( + self, + user: str, + *, + agent: list[str] | None = None, + filter: list[dict[str, object]] | None = None, + ) -> UserThreadListResponse: + query: dict[str, object] = {} + if agent is not None: + query["agent"] = agent + if filter is not None: + query["filter"] = filter + return self._http.request(f"/api/v1/users/{user}/threads", query=query) + + def create(self, user: str, input: UserThreadCreateInput) -> Thread: + return self._http.request(f"/api/v1/users/{user}/threads", method="POST", body=input) + + +class UserResource: + def __init__(self, http: SyncHttpClient): + self._http = http + self.artifacts = UserArtifactResource(http) + self.threads = UserThreadResource(http) + + def me(self) -> User: + return self._http.request("/api/v1/users/me") + + def get(self, user: str) -> User: + return self._http.request(f"/api/v1/users/{user}") + + def invites(self, user: str, input: UserInvitesInput) -> UserInvite: + return self._http.request(f"/api/v1/users/{user}/invites", method="POST", body=input) + + def orgs(self, user: str) -> UserOrgsResponse: + return self._http.request(f"/api/v1/users/{user}/orgs") + + def profile(self, user: str, input: UserProfileInput) -> User: + return self._http.request(f"/api/v1/users/{user}/profile", method="PUT", body=input) diff --git a/tests/contract/v1/test_activity_feed.py b/tests/contract/v1/test_activity_feed.py index 78e00af..1c6bb05 100644 --- a/tests/contract/v1/test_activity_feed.py +++ b/tests/contract/v1/test_activity_feed.py @@ -1,10 +1,10 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: 172c53c0def4 +# Content hash: 66a21f55adeb import pytest -from archastro.platform import PlatformClient +from archastro.platform import AsyncPlatformClient, PlatformClient from archastro.platform.runtime.http_client import ApiError PRISM_URL = "http://127.0.0.1:4040" @@ -26,30 +26,103 @@ def _error_client(code: int) -> PlatformClient: ) -async def test_activity_feed_list_success(): +def _async_client() -> AsyncPlatformClient: + return AsyncPlatformClient( + base_url=PRISM_URL, + default_headers={"x-archastro-api-key": "pk_test-key"}, + access_token="test-token", + ) + + +def _async_error_client(code: int) -> AsyncPlatformClient: + return AsyncPlatformClient( + base_url=PRISM_URL, + default_headers={"x-archastro-api-key": "pk_test-key", "Prefer": f"code={code}"}, + access_token="test-token", + ) + + +def test_activity_feed_list_success(): client = _client() - result = await client.v1.activity_feed.list() - assert result is not None - assert "data" in result - assert isinstance(result["data"], list) + try: + result = client.v1.activity_feed.list() + assert result is not None + assert "data" in result + assert isinstance(result["data"], list) + finally: + client.close() -async def test_activity_feed_list_error_400(): +def test_activity_feed_list_error_400(): ec = _error_client(400) - with pytest.raises(ApiError) as exc_info: - await ec.v1.activity_feed.list() - assert exc_info.value.status == 400 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.activity_feed.list() + assert exc_info.value.status == 400 + finally: + ec.close() -async def test_activity_feed_list_error_401(): +def test_activity_feed_list_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.activity_feed.list() - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.activity_feed.list() + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_activity_feed_list_error_403(): +def test_activity_feed_list_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.activity_feed.list() - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.activity_feed.list() + assert exc_info.value.status == 403 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_activity_feed_list_success(): + client = _async_client() + try: + result = await client.v1.activity_feed.list() + assert result is not None + assert "data" in result + assert isinstance(result["data"], list) + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_activity_feed_list_error_400(): + ec = _async_error_client(400) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.activity_feed.list() + assert exc_info.value.status == 400 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_activity_feed_list_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.activity_feed.list() + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_activity_feed_list_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.activity_feed.list() + assert exc_info.value.status == 403 + finally: + await ec.close() diff --git a/tests/contract/v1/test_agent_computers.py b/tests/contract/v1/test_agent_computers.py index 2a3877d..9070730 100644 --- a/tests/contract/v1/test_agent_computers.py +++ b/tests/contract/v1/test_agent_computers.py @@ -1,10 +1,10 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: e5ef24c69095 +# Content hash: 31206b6d6f41 import pytest -from archastro.platform import PlatformClient +from archastro.platform import AsyncPlatformClient, PlatformClient from archastro.platform.runtime.http_client import ApiError PRISM_URL = "http://127.0.0.1:4040" @@ -26,116 +26,366 @@ def _error_client(code: int) -> PlatformClient: ) -async def test_agent_computers_delete_success(): +def _async_client() -> AsyncPlatformClient: + return AsyncPlatformClient( + base_url=PRISM_URL, + default_headers={"x-archastro-api-key": "pk_test-key"}, + access_token="test-token", + ) + + +def _async_error_client(code: int) -> AsyncPlatformClient: + return AsyncPlatformClient( + base_url=PRISM_URL, + default_headers={"x-archastro-api-key": "pk_test-key", "Prefer": f"code={code}"}, + access_token="test-token", + ) + + +def test_agent_computers_delete_success(): client = _client() - result = await client.v1.agent_computers.delete("test-value") - assert result is None + try: + result = client.v1.agent_computers.delete("test-value") + assert result is None + finally: + client.close() -async def test_agent_computers_delete_error_401(): +def test_agent_computers_delete_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_computers.delete("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_computers.delete("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agent_computers_delete_error_403(): +def test_agent_computers_delete_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_computers.delete("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_computers.delete("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_agent_computers_delete_error_404(): +def test_agent_computers_delete_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_computers.delete("test-value") - assert exc_info.value.status == 404 - - -async def test_agent_computers_get_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_computers.delete("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_computers_delete_success(): + client = _async_client() + try: + result = await client.v1.agent_computers.delete("test-value") + assert result is None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agent_computers_delete_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_computers.delete("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_computers_delete_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_computers.delete("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_computers_delete_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_computers.delete("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +def test_agent_computers_get_success(): client = _client() - result = await client.v1.agent_computers.get("test-value") - assert result is not None + try: + result = client.v1.agent_computers.get("test-value") + assert result is not None + finally: + client.close() -async def test_agent_computers_get_error_401(): +def test_agent_computers_get_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_computers.get("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_computers.get("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agent_computers_get_error_403(): +def test_agent_computers_get_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_computers.get("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_computers.get("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_agent_computers_get_error_404(): +def test_agent_computers_get_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_computers.get("test-value") - assert exc_info.value.status == 404 - - -async def test_agent_computers_exec_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_computers.get("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_computers_get_success(): + client = _async_client() + try: + result = await client.v1.agent_computers.get("test-value") + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agent_computers_get_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_computers.get("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_computers_get_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_computers.get("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_computers_get_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_computers.get("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +def test_agent_computers_exec_success(): client = _client() - result = await client.v1.agent_computers.exec("test-value", {"command": "test-value"}) - assert result is not None + try: + result = client.v1.agent_computers.exec("test-value", {"command": "test-value"}) + assert result is not None + finally: + client.close() -async def test_agent_computers_exec_error_401(): +def test_agent_computers_exec_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_computers.exec("test-value", {"command": "test-value"}) - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_computers.exec("test-value", {"command": "test-value"}) + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agent_computers_exec_error_403(): +def test_agent_computers_exec_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_computers.exec("test-value", {"command": "test-value"}) - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_computers.exec("test-value", {"command": "test-value"}) + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_agent_computers_exec_error_404(): +def test_agent_computers_exec_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_computers.exec("test-value", {"command": "test-value"}) - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_computers.exec("test-value", {"command": "test-value"}) + assert exc_info.value.status == 404 + finally: + ec.close() -async def test_agent_computers_exec_error_422(): +def test_agent_computers_exec_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_computers.exec("test-value", {"command": "test-value"}) - assert exc_info.value.status == 422 - - -async def test_agent_computers_refresh_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_computers.exec("test-value", {"command": "test-value"}) + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_computers_exec_success(): + client = _async_client() + try: + result = await client.v1.agent_computers.exec("test-value", {"command": "test-value"}) + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agent_computers_exec_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_computers.exec("test-value", {"command": "test-value"}) + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_computers_exec_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_computers.exec("test-value", {"command": "test-value"}) + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_computers_exec_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_computers.exec("test-value", {"command": "test-value"}) + assert exc_info.value.status == 404 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_computers_exec_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_computers.exec("test-value", {"command": "test-value"}) + assert exc_info.value.status == 422 + finally: + await ec.close() + + +def test_agent_computers_refresh_success(): client = _client() - result = await client.v1.agent_computers.refresh("test-value") - assert result is not None + try: + result = client.v1.agent_computers.refresh("test-value") + assert result is not None + finally: + client.close() -async def test_agent_computers_refresh_error_401(): +def test_agent_computers_refresh_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_computers.refresh("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_computers.refresh("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agent_computers_refresh_error_403(): +def test_agent_computers_refresh_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_computers.refresh("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_computers.refresh("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_agent_computers_refresh_error_404(): +def test_agent_computers_refresh_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_computers.refresh("test-value") - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_computers.refresh("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_computers_refresh_success(): + client = _async_client() + try: + result = await client.v1.agent_computers.refresh("test-value") + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agent_computers_refresh_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_computers.refresh("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_computers_refresh_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_computers.refresh("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_computers_refresh_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_computers.refresh("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() diff --git a/tests/contract/v1/test_agent_env_vars.py b/tests/contract/v1/test_agent_env_vars.py index 84e5ebe..b802829 100644 --- a/tests/contract/v1/test_agent_env_vars.py +++ b/tests/contract/v1/test_agent_env_vars.py @@ -1,10 +1,10 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: c77e35019aa9 +# Content hash: 6ed796557143 import pytest -from archastro.platform import PlatformClient +from archastro.platform import AsyncPlatformClient, PlatformClient from archastro.platform.runtime.http_client import ApiError PRISM_URL = "http://127.0.0.1:4040" @@ -26,89 +26,284 @@ def _error_client(code: int) -> PlatformClient: ) -async def test_agent_env_vars_delete_success(): +def _async_client() -> AsyncPlatformClient: + return AsyncPlatformClient( + base_url=PRISM_URL, + default_headers={"x-archastro-api-key": "pk_test-key"}, + access_token="test-token", + ) + + +def _async_error_client(code: int) -> AsyncPlatformClient: + return AsyncPlatformClient( + base_url=PRISM_URL, + default_headers={"x-archastro-api-key": "pk_test-key", "Prefer": f"code={code}"}, + access_token="test-token", + ) + + +def test_agent_env_vars_delete_success(): client = _client() - result = await client.v1.agent_env_vars.delete("test-value") - assert result is None + try: + result = client.v1.agent_env_vars.delete("test-value") + assert result is None + finally: + client.close() -async def test_agent_env_vars_delete_error_401(): +def test_agent_env_vars_delete_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_env_vars.delete("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_env_vars.delete("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agent_env_vars_delete_error_403(): +def test_agent_env_vars_delete_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_env_vars.delete("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_env_vars.delete("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_agent_env_vars_delete_error_404(): +def test_agent_env_vars_delete_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_env_vars.delete("test-value") - assert exc_info.value.status == 404 - - -async def test_agent_env_vars_get_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_env_vars.delete("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_env_vars_delete_success(): + client = _async_client() + try: + result = await client.v1.agent_env_vars.delete("test-value") + assert result is None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agent_env_vars_delete_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_env_vars.delete("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_env_vars_delete_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_env_vars.delete("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_env_vars_delete_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_env_vars.delete("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +def test_agent_env_vars_get_success(): client = _client() - result = await client.v1.agent_env_vars.get("test-value") - assert result is not None + try: + result = client.v1.agent_env_vars.get("test-value") + assert result is not None + finally: + client.close() -async def test_agent_env_vars_get_error_401(): +def test_agent_env_vars_get_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_env_vars.get("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_env_vars.get("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agent_env_vars_get_error_403(): +def test_agent_env_vars_get_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_env_vars.get("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_env_vars.get("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_agent_env_vars_get_error_404(): +def test_agent_env_vars_get_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_env_vars.get("test-value") - assert exc_info.value.status == 404 - - -async def test_agent_env_vars_update_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_env_vars.get("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_env_vars_get_success(): + client = _async_client() + try: + result = await client.v1.agent_env_vars.get("test-value") + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agent_env_vars_get_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_env_vars.get("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_env_vars_get_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_env_vars.get("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_env_vars_get_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_env_vars.get("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +def test_agent_env_vars_update_success(): client = _client() - result = await client.v1.agent_env_vars.update("test-value", {}) - assert result is not None + try: + result = client.v1.agent_env_vars.update("test-value", {}) + assert result is not None + finally: + client.close() -async def test_agent_env_vars_update_error_401(): +def test_agent_env_vars_update_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_env_vars.update("test-value", {}) - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_env_vars.update("test-value", {}) + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agent_env_vars_update_error_403(): +def test_agent_env_vars_update_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_env_vars.update("test-value", {}) - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_env_vars.update("test-value", {}) + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_agent_env_vars_update_error_404(): +def test_agent_env_vars_update_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_env_vars.update("test-value", {}) - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_env_vars.update("test-value", {}) + assert exc_info.value.status == 404 + finally: + ec.close() -async def test_agent_env_vars_update_error_422(): +def test_agent_env_vars_update_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_env_vars.update("test-value", {}) - assert exc_info.value.status == 422 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_env_vars.update("test-value", {}) + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_env_vars_update_success(): + client = _async_client() + try: + result = await client.v1.agent_env_vars.update("test-value", {}) + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agent_env_vars_update_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_env_vars.update("test-value", {}) + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_env_vars_update_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_env_vars.update("test-value", {}) + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_env_vars_update_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_env_vars.update("test-value", {}) + assert exc_info.value.status == 404 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_env_vars_update_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_env_vars.update("test-value", {}) + assert exc_info.value.status == 422 + finally: + await ec.close() diff --git a/tests/contract/v1/test_agent_health_actions.py b/tests/contract/v1/test_agent_health_actions.py index dbdad4e..873b930 100644 --- a/tests/contract/v1/test_agent_health_actions.py +++ b/tests/contract/v1/test_agent_health_actions.py @@ -1,10 +1,10 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: 5b18cffbfa41 +# Content hash: 4238ea16a70d import pytest -from archastro.platform import PlatformClient +from archastro.platform import AsyncPlatformClient, PlatformClient from archastro.platform.runtime.http_client import ApiError PRISM_URL = "http://127.0.0.1:4040" @@ -26,62 +26,202 @@ def _error_client(code: int) -> PlatformClient: ) -async def test_agent_health_actions_get_success(): +def _async_client() -> AsyncPlatformClient: + return AsyncPlatformClient( + base_url=PRISM_URL, + default_headers={"x-archastro-api-key": "pk_test-key"}, + access_token="test-token", + ) + + +def _async_error_client(code: int) -> AsyncPlatformClient: + return AsyncPlatformClient( + base_url=PRISM_URL, + default_headers={"x-archastro-api-key": "pk_test-key", "Prefer": f"code={code}"}, + access_token="test-token", + ) + + +def test_agent_health_actions_get_success(): client = _client() - result = await client.v1.agent_health_actions.get("test-value") - assert result is not None + try: + result = client.v1.agent_health_actions.get("test-value") + assert result is not None + finally: + client.close() -async def test_agent_health_actions_get_error_401(): +def test_agent_health_actions_get_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_health_actions.get("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_health_actions.get("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agent_health_actions_get_error_403(): +def test_agent_health_actions_get_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_health_actions.get("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_health_actions.get("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_agent_health_actions_get_error_404(): +def test_agent_health_actions_get_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_health_actions.get("test-value") - assert exc_info.value.status == 404 - - -async def test_agent_health_actions_verify_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_health_actions.get("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_health_actions_get_success(): + client = _async_client() + try: + result = await client.v1.agent_health_actions.get("test-value") + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agent_health_actions_get_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_health_actions.get("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_health_actions_get_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_health_actions.get("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_health_actions_get_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_health_actions.get("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +def test_agent_health_actions_verify_success(): client = _client() - result = await client.v1.agent_health_actions.verify("test-value") - assert result is not None + try: + result = client.v1.agent_health_actions.verify("test-value") + assert result is not None + finally: + client.close() -async def test_agent_health_actions_verify_error_401(): +def test_agent_health_actions_verify_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_health_actions.verify("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_health_actions.verify("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agent_health_actions_verify_error_403(): +def test_agent_health_actions_verify_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_health_actions.verify("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_health_actions.verify("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_agent_health_actions_verify_error_404(): +def test_agent_health_actions_verify_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_health_actions.verify("test-value") - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_health_actions.verify("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() -async def test_agent_health_actions_verify_error_422(): +def test_agent_health_actions_verify_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_health_actions.verify("test-value") - assert exc_info.value.status == 422 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_health_actions.verify("test-value") + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_health_actions_verify_success(): + client = _async_client() + try: + result = await client.v1.agent_health_actions.verify("test-value") + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agent_health_actions_verify_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_health_actions.verify("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_health_actions_verify_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_health_actions.verify("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_health_actions_verify_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_health_actions.verify("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_health_actions_verify_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_health_actions.verify("test-value") + assert exc_info.value.status == 422 + finally: + await ec.close() diff --git a/tests/contract/v1/test_agent_installations.py b/tests/contract/v1/test_agent_installations.py index dfbffe9..0a38f46 100644 --- a/tests/contract/v1/test_agent_installations.py +++ b/tests/contract/v1/test_agent_installations.py @@ -1,10 +1,10 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: 21f1c7ed0841 +# Content hash: 8606c31c1bb3 import pytest -from archastro.platform import PlatformClient +from archastro.platform import AsyncPlatformClient, PlatformClient from archastro.platform.runtime.http_client import ApiError PRISM_URL = "http://127.0.0.1:4040" @@ -26,248 +26,756 @@ def _error_client(code: int) -> PlatformClient: ) -async def test_agent_installations_list_success(): +def _async_client() -> AsyncPlatformClient: + return AsyncPlatformClient( + base_url=PRISM_URL, + default_headers={"x-archastro-api-key": "pk_test-key"}, + access_token="test-token", + ) + + +def _async_error_client(code: int) -> AsyncPlatformClient: + return AsyncPlatformClient( + base_url=PRISM_URL, + default_headers={"x-archastro-api-key": "pk_test-key", "Prefer": f"code={code}"}, + access_token="test-token", + ) + + +def test_agent_installations_list_success(): client = _client() - result = await client.v1.agent_installations.list() - assert result is not None + try: + result = client.v1.agent_installations.list() + assert result is not None + finally: + client.close() -async def test_agent_installations_list_error_401(): +def test_agent_installations_list_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_installations.list() - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_installations.list() + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agent_installations_list_error_403(): +def test_agent_installations_list_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_installations.list() - assert exc_info.value.status == 403 - - -async def test_agent_installations_delete_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_installations.list() + assert exc_info.value.status == 403 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_installations_list_success(): + client = _async_client() + try: + result = await client.v1.agent_installations.list() + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agent_installations_list_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_installations.list() + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_installations_list_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_installations.list() + assert exc_info.value.status == 403 + finally: + await ec.close() + + +def test_agent_installations_delete_success(): client = _client() - result = await client.v1.agent_installations.delete("test-value") - assert result is None + try: + result = client.v1.agent_installations.delete("test-value") + assert result is None + finally: + client.close() -async def test_agent_installations_delete_error_401(): +def test_agent_installations_delete_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_installations.delete("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_installations.delete("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agent_installations_delete_error_403(): +def test_agent_installations_delete_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_installations.delete("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_installations.delete("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_agent_installations_delete_error_404(): +def test_agent_installations_delete_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_installations.delete("test-value") - assert exc_info.value.status == 404 - - -async def test_agent_installations_get_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_installations.delete("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_installations_delete_success(): + client = _async_client() + try: + result = await client.v1.agent_installations.delete("test-value") + assert result is None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agent_installations_delete_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_installations.delete("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_installations_delete_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_installations.delete("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_installations_delete_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_installations.delete("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +def test_agent_installations_get_success(): client = _client() - result = await client.v1.agent_installations.get("test-value") - assert result is not None + try: + result = client.v1.agent_installations.get("test-value") + assert result is not None + finally: + client.close() -async def test_agent_installations_get_error_401(): +def test_agent_installations_get_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_installations.get("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_installations.get("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agent_installations_get_error_403(): +def test_agent_installations_get_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_installations.get("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_installations.get("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_agent_installations_get_error_404(): +def test_agent_installations_get_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_installations.get("test-value") - assert exc_info.value.status == 404 - - -async def test_agent_installations_activate_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_installations.get("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_installations_get_success(): + client = _async_client() + try: + result = await client.v1.agent_installations.get("test-value") + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agent_installations_get_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_installations.get("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_installations_get_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_installations.get("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_installations_get_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_installations.get("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +def test_agent_installations_activate_success(): client = _client() - result = await client.v1.agent_installations.activate("test-value") - assert result is not None + try: + result = client.v1.agent_installations.activate("test-value") + assert result is not None + finally: + client.close() -async def test_agent_installations_activate_error_401(): +def test_agent_installations_activate_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_installations.activate("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_installations.activate("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agent_installations_activate_error_403(): +def test_agent_installations_activate_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_installations.activate("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_installations.activate("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_agent_installations_activate_error_404(): +def test_agent_installations_activate_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_installations.activate("test-value") - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_installations.activate("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() -async def test_agent_installations_activate_error_422(): +def test_agent_installations_activate_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_installations.activate("test-value") - assert exc_info.value.status == 422 - - -async def test_agent_installations_pause_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_installations.activate("test-value") + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_installations_activate_success(): + client = _async_client() + try: + result = await client.v1.agent_installations.activate("test-value") + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agent_installations_activate_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_installations.activate("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_installations_activate_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_installations.activate("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_installations_activate_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_installations.activate("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_installations_activate_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_installations.activate("test-value") + assert exc_info.value.status == 422 + finally: + await ec.close() + + +def test_agent_installations_pause_success(): client = _client() - result = await client.v1.agent_installations.pause("test-value") - assert result is not None + try: + result = client.v1.agent_installations.pause("test-value") + assert result is not None + finally: + client.close() -async def test_agent_installations_pause_error_401(): +def test_agent_installations_pause_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_installations.pause("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_installations.pause("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agent_installations_pause_error_403(): +def test_agent_installations_pause_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_installations.pause("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_installations.pause("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_agent_installations_pause_error_404(): +def test_agent_installations_pause_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_installations.pause("test-value") - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_installations.pause("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() -async def test_agent_installations_pause_error_422(): +def test_agent_installations_pause_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_installations.pause("test-value") - assert exc_info.value.status == 422 - - -async def test_agent_installations_suspend_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_installations.pause("test-value") + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_installations_pause_success(): + client = _async_client() + try: + result = await client.v1.agent_installations.pause("test-value") + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agent_installations_pause_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_installations.pause("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_installations_pause_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_installations.pause("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_installations_pause_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_installations.pause("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_installations_pause_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_installations.pause("test-value") + assert exc_info.value.status == 422 + finally: + await ec.close() + + +def test_agent_installations_suspend_success(): client = _client() - result = await client.v1.agent_installations.suspend("test-value", {}) - assert result is not None + try: + result = client.v1.agent_installations.suspend("test-value", {}) + assert result is not None + finally: + client.close() -async def test_agent_installations_suspend_error_401(): +def test_agent_installations_suspend_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_installations.suspend("test-value", {}) - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_installations.suspend("test-value", {}) + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agent_installations_suspend_error_403(): +def test_agent_installations_suspend_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_installations.suspend("test-value", {}) - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_installations.suspend("test-value", {}) + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_agent_installations_suspend_error_404(): +def test_agent_installations_suspend_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_installations.suspend("test-value", {}) - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_installations.suspend("test-value", {}) + assert exc_info.value.status == 404 + finally: + ec.close() -async def test_agent_installations_suspend_error_422(): +def test_agent_installations_suspend_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_installations.suspend("test-value", {}) - assert exc_info.value.status == 422 - - -async def test_agent_installations_installation_sources_list_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_installations.suspend("test-value", {}) + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_installations_suspend_success(): + client = _async_client() + try: + result = await client.v1.agent_installations.suspend("test-value", {}) + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agent_installations_suspend_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_installations.suspend("test-value", {}) + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_installations_suspend_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_installations.suspend("test-value", {}) + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_installations_suspend_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_installations.suspend("test-value", {}) + assert exc_info.value.status == 404 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_installations_suspend_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_installations.suspend("test-value", {}) + assert exc_info.value.status == 422 + finally: + await ec.close() + + +def test_agent_installations_installation_sources_list_success(): client = _client() - result = await client.v1.agent_installations.installation_sources.list("test-value") - assert result is not None + try: + result = client.v1.agent_installations.installation_sources.list("test-value") + assert result is not None + finally: + client.close() -async def test_agent_installations_installation_sources_list_error_401(): +def test_agent_installations_installation_sources_list_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_installations.installation_sources.list("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_installations.installation_sources.list("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agent_installations_installation_sources_list_error_403(): +def test_agent_installations_installation_sources_list_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_installations.installation_sources.list("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_installations.installation_sources.list("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_agent_installations_installation_sources_list_error_404(): +def test_agent_installations_installation_sources_list_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_installations.installation_sources.list("test-value") - assert exc_info.value.status == 404 - - -async def test_agent_installations_installation_sources_create_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_installations.installation_sources.list("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_installations_installation_sources_list_success(): + client = _async_client() + try: + result = await client.v1.agent_installations.installation_sources.list("test-value") + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agent_installations_installation_sources_list_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_installations.installation_sources.list("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_installations_installation_sources_list_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_installations.installation_sources.list("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_installations_installation_sources_list_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_installations.installation_sources.list("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +def test_agent_installations_installation_sources_create_success(): client = _client() - result = await client.v1.agent_installations.installation_sources.create( - "test-value", {"payload": {}, "type": "test"} - ) - assert result is not None + try: + result = client.v1.agent_installations.installation_sources.create( + "test-value", {"payload": {}, "type": "test"} + ) + assert result is not None + finally: + client.close() -async def test_agent_installations_installation_sources_create_error_401(): +def test_agent_installations_installation_sources_create_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_installations.installation_sources.create( - "test-value", {"payload": {}, "type": "test"} - ) - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_installations.installation_sources.create( + "test-value", {"payload": {}, "type": "test"} + ) + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agent_installations_installation_sources_create_error_403(): +def test_agent_installations_installation_sources_create_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_installations.installation_sources.create( - "test-value", {"payload": {}, "type": "test"} - ) - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_installations.installation_sources.create( + "test-value", {"payload": {}, "type": "test"} + ) + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_agent_installations_installation_sources_create_error_404(): +def test_agent_installations_installation_sources_create_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_installations.installation_sources.create( - "test-value", {"payload": {}, "type": "test"} - ) - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_installations.installation_sources.create( + "test-value", {"payload": {}, "type": "test"} + ) + assert exc_info.value.status == 404 + finally: + ec.close() -async def test_agent_installations_installation_sources_create_error_422(): +def test_agent_installations_installation_sources_create_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_installations.installation_sources.create( + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_installations.installation_sources.create( + "test-value", {"payload": {}, "type": "test"} + ) + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_installations_installation_sources_create_success(): + client = _async_client() + try: + result = await client.v1.agent_installations.installation_sources.create( "test-value", {"payload": {}, "type": "test"} ) - assert exc_info.value.status == 422 + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agent_installations_installation_sources_create_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_installations.installation_sources.create( + "test-value", {"payload": {}, "type": "test"} + ) + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_installations_installation_sources_create_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_installations.installation_sources.create( + "test-value", {"payload": {}, "type": "test"} + ) + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_installations_installation_sources_create_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_installations.installation_sources.create( + "test-value", {"payload": {}, "type": "test"} + ) + assert exc_info.value.status == 404 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_installations_installation_sources_create_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_installations.installation_sources.create( + "test-value", {"payload": {}, "type": "test"} + ) + assert exc_info.value.status == 422 + finally: + await ec.close() diff --git a/tests/contract/v1/test_agent_routine_runs.py b/tests/contract/v1/test_agent_routine_runs.py index e58e6bb..a1eff91 100644 --- a/tests/contract/v1/test_agent_routine_runs.py +++ b/tests/contract/v1/test_agent_routine_runs.py @@ -1,10 +1,10 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: 33c0f3feb645 +# Content hash: d30e9ae74a61 import pytest -from archastro.platform import PlatformClient +from archastro.platform import AsyncPlatformClient, PlatformClient from archastro.platform.runtime.http_client import ApiError PRISM_URL = "http://127.0.0.1:4040" @@ -26,35 +26,120 @@ def _error_client(code: int) -> PlatformClient: ) -async def test_agent_routine_runs_list_success(): +def _async_client() -> AsyncPlatformClient: + return AsyncPlatformClient( + base_url=PRISM_URL, + default_headers={"x-archastro-api-key": "pk_test-key"}, + access_token="test-token", + ) + + +def _async_error_client(code: int) -> AsyncPlatformClient: + return AsyncPlatformClient( + base_url=PRISM_URL, + default_headers={"x-archastro-api-key": "pk_test-key", "Prefer": f"code={code}"}, + access_token="test-token", + ) + + +def test_agent_routine_runs_list_success(): client = _client() - result = await client.v1.agent_routine_runs.list() - assert result is not None + try: + result = client.v1.agent_routine_runs.list() + assert result is not None + finally: + client.close() -async def test_agent_routine_runs_list_error_400(): +def test_agent_routine_runs_list_error_400(): ec = _error_client(400) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_routine_runs.list() - assert exc_info.value.status == 400 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_routine_runs.list() + assert exc_info.value.status == 400 + finally: + ec.close() -async def test_agent_routine_runs_list_error_401(): +def test_agent_routine_runs_list_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_routine_runs.list() - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_routine_runs.list() + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agent_routine_runs_list_error_403(): +def test_agent_routine_runs_list_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_routine_runs.list() - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_routine_runs.list() + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_agent_routine_runs_list_error_404(): +def test_agent_routine_runs_list_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_routine_runs.list() - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_routine_runs.list() + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_routine_runs_list_success(): + client = _async_client() + try: + result = await client.v1.agent_routine_runs.list() + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agent_routine_runs_list_error_400(): + ec = _async_error_client(400) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_routine_runs.list() + assert exc_info.value.status == 400 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_routine_runs_list_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_routine_runs.list() + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_routine_runs_list_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_routine_runs.list() + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_routine_runs_list_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_routine_runs.list() + assert exc_info.value.status == 404 + finally: + await ec.close() diff --git a/tests/contract/v1/test_agent_routines.py b/tests/contract/v1/test_agent_routines.py index 160b95a..c28ce72 100644 --- a/tests/contract/v1/test_agent_routines.py +++ b/tests/contract/v1/test_agent_routines.py @@ -1,10 +1,10 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: 657519d015d7 +# Content hash: 1bf1b3e166a9 import pytest -from archastro.platform import PlatformClient +from archastro.platform import AsyncPlatformClient, PlatformClient from archastro.platform.runtime.http_client import ApiError PRISM_URL = "http://127.0.0.1:4040" @@ -26,299 +26,921 @@ def _error_client(code: int) -> PlatformClient: ) -async def test_agent_routines_list_success(): +def _async_client() -> AsyncPlatformClient: + return AsyncPlatformClient( + base_url=PRISM_URL, + default_headers={"x-archastro-api-key": "pk_test-key"}, + access_token="test-token", + ) + + +def _async_error_client(code: int) -> AsyncPlatformClient: + return AsyncPlatformClient( + base_url=PRISM_URL, + default_headers={"x-archastro-api-key": "pk_test-key", "Prefer": f"code={code}"}, + access_token="test-token", + ) + + +def test_agent_routines_list_success(): client = _client() - result = await client.v1.agent_routines.list() - assert result is not None + try: + result = client.v1.agent_routines.list() + assert result is not None + finally: + client.close() -async def test_agent_routines_list_error_401(): +def test_agent_routines_list_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_routines.list() - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_routines.list() + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agent_routines_list_error_403(): +def test_agent_routines_list_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_routines.list() - assert exc_info.value.status == 403 - - -async def test_agent_routines_presets_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_routines.list() + assert exc_info.value.status == 403 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_routines_list_success(): + client = _async_client() + try: + result = await client.v1.agent_routines.list() + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agent_routines_list_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_routines.list() + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_routines_list_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_routines.list() + assert exc_info.value.status == 403 + finally: + await ec.close() + + +def test_agent_routines_presets_success(): client = _client() - result = await client.v1.agent_routines.presets() - assert result is not None + try: + result = client.v1.agent_routines.presets() + assert result is not None + finally: + client.close() -async def test_agent_routines_presets_error_401(): +def test_agent_routines_presets_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_routines.presets() - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_routines.presets() + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agent_routines_presets_error_403(): +def test_agent_routines_presets_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_routines.presets() - assert exc_info.value.status == 403 - - -async def test_agent_routines_delete_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_routines.presets() + assert exc_info.value.status == 403 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_routines_presets_success(): + client = _async_client() + try: + result = await client.v1.agent_routines.presets() + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agent_routines_presets_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_routines.presets() + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_routines_presets_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_routines.presets() + assert exc_info.value.status == 403 + finally: + await ec.close() + + +def test_agent_routines_delete_success(): client = _client() - result = await client.v1.agent_routines.delete("test-value") - assert result is None + try: + result = client.v1.agent_routines.delete("test-value") + assert result is None + finally: + client.close() -async def test_agent_routines_delete_error_401(): +def test_agent_routines_delete_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_routines.delete("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_routines.delete("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agent_routines_delete_error_403(): +def test_agent_routines_delete_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_routines.delete("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_routines.delete("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_agent_routines_delete_error_404(): +def test_agent_routines_delete_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_routines.delete("test-value") - assert exc_info.value.status == 404 - - -async def test_agent_routines_get_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_routines.delete("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_routines_delete_success(): + client = _async_client() + try: + result = await client.v1.agent_routines.delete("test-value") + assert result is None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agent_routines_delete_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_routines.delete("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_routines_delete_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_routines.delete("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_routines_delete_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_routines.delete("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +def test_agent_routines_get_success(): client = _client() - result = await client.v1.agent_routines.get("test-value") - assert result is not None + try: + result = client.v1.agent_routines.get("test-value") + assert result is not None + finally: + client.close() -async def test_agent_routines_get_error_401(): +def test_agent_routines_get_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_routines.get("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_routines.get("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agent_routines_get_error_403(): +def test_agent_routines_get_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_routines.get("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_routines.get("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_agent_routines_get_error_404(): +def test_agent_routines_get_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_routines.get("test-value") - assert exc_info.value.status == 404 - - -async def test_agent_routines_update_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_routines.get("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_routines_get_success(): + client = _async_client() + try: + result = await client.v1.agent_routines.get("test-value") + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agent_routines_get_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_routines.get("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_routines_get_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_routines.get("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_routines_get_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_routines.get("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +def test_agent_routines_update_success(): client = _client() - result = await client.v1.agent_routines.update("test-value", {}) - assert result is not None + try: + result = client.v1.agent_routines.update("test-value", {}) + assert result is not None + finally: + client.close() -async def test_agent_routines_update_error_401(): +def test_agent_routines_update_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_routines.update("test-value", {}) - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_routines.update("test-value", {}) + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agent_routines_update_error_403(): +def test_agent_routines_update_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_routines.update("test-value", {}) - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_routines.update("test-value", {}) + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_agent_routines_update_error_404(): +def test_agent_routines_update_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_routines.update("test-value", {}) - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_routines.update("test-value", {}) + assert exc_info.value.status == 404 + finally: + ec.close() -async def test_agent_routines_update_error_422(): +def test_agent_routines_update_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_routines.update("test-value", {}) - assert exc_info.value.status == 422 - - -async def test_agent_routines_activate_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_routines.update("test-value", {}) + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_routines_update_success(): + client = _async_client() + try: + result = await client.v1.agent_routines.update("test-value", {}) + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agent_routines_update_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_routines.update("test-value", {}) + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_routines_update_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_routines.update("test-value", {}) + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_routines_update_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_routines.update("test-value", {}) + assert exc_info.value.status == 404 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_routines_update_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_routines.update("test-value", {}) + assert exc_info.value.status == 422 + finally: + await ec.close() + + +def test_agent_routines_activate_success(): client = _client() - result = await client.v1.agent_routines.activate("test-value") - assert result is not None + try: + result = client.v1.agent_routines.activate("test-value") + assert result is not None + finally: + client.close() -async def test_agent_routines_activate_error_401(): +def test_agent_routines_activate_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_routines.activate("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_routines.activate("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agent_routines_activate_error_403(): +def test_agent_routines_activate_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_routines.activate("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_routines.activate("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_agent_routines_activate_error_404(): +def test_agent_routines_activate_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_routines.activate("test-value") - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_routines.activate("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() -async def test_agent_routines_activate_error_422(): +def test_agent_routines_activate_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_routines.activate("test-value") - assert exc_info.value.status == 422 - - -async def test_agent_routines_invoke_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_routines.activate("test-value") + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_routines_activate_success(): + client = _async_client() + try: + result = await client.v1.agent_routines.activate("test-value") + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agent_routines_activate_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_routines.activate("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_routines_activate_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_routines.activate("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_routines_activate_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_routines.activate("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_routines_activate_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_routines.activate("test-value") + assert exc_info.value.status == 422 + finally: + await ec.close() + + +def test_agent_routines_invoke_success(): client = _client() - result = await client.v1.agent_routines.invoke("test-value", {"message": "test-value"}) - assert result is not None + try: + result = client.v1.agent_routines.invoke("test-value", {"message": "test-value"}) + assert result is not None + finally: + client.close() -async def test_agent_routines_invoke_error_400(): +def test_agent_routines_invoke_error_400(): ec = _error_client(400) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_routines.invoke("test-value", {"message": "test-value"}) - assert exc_info.value.status == 400 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_routines.invoke("test-value", {"message": "test-value"}) + assert exc_info.value.status == 400 + finally: + ec.close() -async def test_agent_routines_invoke_error_401(): +def test_agent_routines_invoke_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_routines.invoke("test-value", {"message": "test-value"}) - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_routines.invoke("test-value", {"message": "test-value"}) + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agent_routines_invoke_error_402(): +def test_agent_routines_invoke_error_402(): ec = _error_client(402) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_routines.invoke("test-value", {"message": "test-value"}) - assert exc_info.value.status == 402 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_routines.invoke("test-value", {"message": "test-value"}) + assert exc_info.value.status == 402 + finally: + ec.close() -async def test_agent_routines_invoke_error_403(): +def test_agent_routines_invoke_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_routines.invoke("test-value", {"message": "test-value"}) - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_routines.invoke("test-value", {"message": "test-value"}) + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_agent_routines_invoke_error_404(): +def test_agent_routines_invoke_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_routines.invoke("test-value", {"message": "test-value"}) - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_routines.invoke("test-value", {"message": "test-value"}) + assert exc_info.value.status == 404 + finally: + ec.close() -async def test_agent_routines_invoke_error_422(): +def test_agent_routines_invoke_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_routines.invoke("test-value", {"message": "test-value"}) - assert exc_info.value.status == 422 - - -async def test_agent_routines_pause_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_routines.invoke("test-value", {"message": "test-value"}) + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_routines_invoke_success(): + client = _async_client() + try: + result = await client.v1.agent_routines.invoke("test-value", {"message": "test-value"}) + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agent_routines_invoke_error_400(): + ec = _async_error_client(400) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_routines.invoke("test-value", {"message": "test-value"}) + assert exc_info.value.status == 400 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_routines_invoke_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_routines.invoke("test-value", {"message": "test-value"}) + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_routines_invoke_error_402(): + ec = _async_error_client(402) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_routines.invoke("test-value", {"message": "test-value"}) + assert exc_info.value.status == 402 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_routines_invoke_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_routines.invoke("test-value", {"message": "test-value"}) + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_routines_invoke_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_routines.invoke("test-value", {"message": "test-value"}) + assert exc_info.value.status == 404 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_routines_invoke_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_routines.invoke("test-value", {"message": "test-value"}) + assert exc_info.value.status == 422 + finally: + await ec.close() + + +def test_agent_routines_pause_success(): client = _client() - result = await client.v1.agent_routines.pause("test-value") - assert result is not None + try: + result = client.v1.agent_routines.pause("test-value") + assert result is not None + finally: + client.close() -async def test_agent_routines_pause_error_401(): +def test_agent_routines_pause_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_routines.pause("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_routines.pause("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agent_routines_pause_error_403(): +def test_agent_routines_pause_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_routines.pause("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_routines.pause("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_agent_routines_pause_error_404(): +def test_agent_routines_pause_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_routines.pause("test-value") - assert exc_info.value.status == 404 - - -async def test_agent_routines_runs_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_routines.pause("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_routines_pause_success(): + client = _async_client() + try: + result = await client.v1.agent_routines.pause("test-value") + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agent_routines_pause_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_routines.pause("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_routines_pause_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_routines.pause("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_routines_pause_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_routines.pause("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +def test_agent_routines_runs_success(): client = _client() - result = await client.v1.agent_routines.runs("test-value") - assert result is not None + try: + result = client.v1.agent_routines.runs("test-value") + assert result is not None + finally: + client.close() -async def test_agent_routines_runs_error_400(): +def test_agent_routines_runs_error_400(): ec = _error_client(400) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_routines.runs("test-value") - assert exc_info.value.status == 400 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_routines.runs("test-value") + assert exc_info.value.status == 400 + finally: + ec.close() -async def test_agent_routines_runs_error_401(): +def test_agent_routines_runs_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_routines.runs("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_routines.runs("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agent_routines_runs_error_403(): +def test_agent_routines_runs_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_routines.runs("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_routines.runs("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_agent_routines_runs_error_404(): +def test_agent_routines_runs_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_routines.runs("test-value") - assert exc_info.value.status == 404 - - -async def test_agent_routines_agent_routine_runs_get_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_routines.runs("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_routines_runs_success(): + client = _async_client() + try: + result = await client.v1.agent_routines.runs("test-value") + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agent_routines_runs_error_400(): + ec = _async_error_client(400) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_routines.runs("test-value") + assert exc_info.value.status == 400 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_routines_runs_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_routines.runs("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_routines_runs_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_routines.runs("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_routines_runs_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_routines.runs("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +def test_agent_routines_agent_routine_runs_get_success(): client = _client() - result = await client.v1.agent_routines.agent_routine_runs.get("test-value") - assert result is not None + try: + result = client.v1.agent_routines.agent_routine_runs.get("test-value") + assert result is not None + finally: + client.close() -async def test_agent_routines_agent_routine_runs_get_error_401(): +def test_agent_routines_agent_routine_runs_get_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_routines.agent_routine_runs.get("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_routines.agent_routine_runs.get("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agent_routines_agent_routine_runs_get_error_403(): +def test_agent_routines_agent_routine_runs_get_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_routines.agent_routine_runs.get("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_routines.agent_routine_runs.get("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_agent_routines_agent_routine_runs_get_error_404(): +def test_agent_routines_agent_routine_runs_get_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_routines.agent_routine_runs.get("test-value") - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_routines.agent_routine_runs.get("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_routines_agent_routine_runs_get_success(): + client = _async_client() + try: + result = await client.v1.agent_routines.agent_routine_runs.get("test-value") + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agent_routines_agent_routine_runs_get_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_routines.agent_routine_runs.get("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_routines_agent_routine_runs_get_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_routines.agent_routine_runs.get("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_routines_agent_routine_runs_get_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_routines.agent_routine_runs.get("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() diff --git a/tests/contract/v1/test_agent_sessions.py b/tests/contract/v1/test_agent_sessions.py index c3c45f5..52f564c 100644 --- a/tests/contract/v1/test_agent_sessions.py +++ b/tests/contract/v1/test_agent_sessions.py @@ -1,10 +1,10 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: d151df8b05da +# Content hash: f7fa2672c91c import pytest -from archastro.platform import PlatformClient +from archastro.platform import AsyncPlatformClient, PlatformClient from archastro.platform.runtime.http_client import ApiError PRISM_URL = "http://127.0.0.1:4040" @@ -26,213 +26,658 @@ def _error_client(code: int) -> PlatformClient: ) -async def test_agent_sessions_list_success(): +def _async_client() -> AsyncPlatformClient: + return AsyncPlatformClient( + base_url=PRISM_URL, + default_headers={"x-archastro-api-key": "pk_test-key"}, + access_token="test-token", + ) + + +def _async_error_client(code: int) -> AsyncPlatformClient: + return AsyncPlatformClient( + base_url=PRISM_URL, + default_headers={"x-archastro-api-key": "pk_test-key", "Prefer": f"code={code}"}, + access_token="test-token", + ) + + +def test_agent_sessions_list_success(): client = _client() - result = await client.v1.agent_sessions.list() - assert result is not None + try: + result = client.v1.agent_sessions.list() + assert result is not None + finally: + client.close() -async def test_agent_sessions_list_error_401(): +def test_agent_sessions_list_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_sessions.list() - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_sessions.list() + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agent_sessions_list_error_403(): +def test_agent_sessions_list_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_sessions.list() - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_sessions.list() + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_agent_sessions_list_error_422(): +def test_agent_sessions_list_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_sessions.list() - assert exc_info.value.status == 422 - - -async def test_agent_sessions_create_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_sessions.list() + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_sessions_list_success(): + client = _async_client() + try: + result = await client.v1.agent_sessions.list() + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agent_sessions_list_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_sessions.list() + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_sessions_list_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_sessions.list() + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_sessions_list_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_sessions.list() + assert exc_info.value.status == 422 + finally: + await ec.close() + + +def test_agent_sessions_create_success(): client = _client() - result = await client.v1.agent_sessions.create( - {"agent": "test-value", "instructions": "test-value"} - ) - assert result is not None + try: + result = client.v1.agent_sessions.create( + {"agent": "test-value", "instructions": "test-value"} + ) + assert result is not None + finally: + client.close() -async def test_agent_sessions_create_error_401(): +def test_agent_sessions_create_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_sessions.create({"agent": "test-value", "instructions": "test-value"}) - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_sessions.create({"agent": "test-value", "instructions": "test-value"}) + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agent_sessions_create_error_403(): +def test_agent_sessions_create_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_sessions.create({"agent": "test-value", "instructions": "test-value"}) - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_sessions.create({"agent": "test-value", "instructions": "test-value"}) + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_agent_sessions_create_error_404(): +def test_agent_sessions_create_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_sessions.create({"agent": "test-value", "instructions": "test-value"}) - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_sessions.create({"agent": "test-value", "instructions": "test-value"}) + assert exc_info.value.status == 404 + finally: + ec.close() -async def test_agent_sessions_create_error_422(): +def test_agent_sessions_create_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_sessions.create({"agent": "test-value", "instructions": "test-value"}) - assert exc_info.value.status == 422 - - -async def test_agent_sessions_delete_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_sessions.create({"agent": "test-value", "instructions": "test-value"}) + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_sessions_create_success(): + client = _async_client() + try: + result = await client.v1.agent_sessions.create( + {"agent": "test-value", "instructions": "test-value"} + ) + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agent_sessions_create_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_sessions.create({"agent": "test-value", "instructions": "test-value"}) + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_sessions_create_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_sessions.create({"agent": "test-value", "instructions": "test-value"}) + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_sessions_create_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_sessions.create({"agent": "test-value", "instructions": "test-value"}) + assert exc_info.value.status == 404 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_sessions_create_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_sessions.create({"agent": "test-value", "instructions": "test-value"}) + assert exc_info.value.status == 422 + finally: + await ec.close() + + +def test_agent_sessions_delete_success(): client = _client() - result = await client.v1.agent_sessions.delete("test-value") - assert result is None + try: + result = client.v1.agent_sessions.delete("test-value") + assert result is None + finally: + client.close() -async def test_agent_sessions_delete_error_401(): +def test_agent_sessions_delete_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_sessions.delete("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_sessions.delete("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agent_sessions_delete_error_403(): +def test_agent_sessions_delete_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_sessions.delete("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_sessions.delete("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_agent_sessions_delete_error_404(): +def test_agent_sessions_delete_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_sessions.delete("test-value") - assert exc_info.value.status == 404 - - -async def test_agent_sessions_get_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_sessions.delete("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_sessions_delete_success(): + client = _async_client() + try: + result = await client.v1.agent_sessions.delete("test-value") + assert result is None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agent_sessions_delete_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_sessions.delete("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_sessions_delete_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_sessions.delete("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_sessions_delete_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_sessions.delete("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +def test_agent_sessions_get_success(): client = _client() - result = await client.v1.agent_sessions.get("test-value") - assert result is not None + try: + result = client.v1.agent_sessions.get("test-value") + assert result is not None + finally: + client.close() -async def test_agent_sessions_get_error_401(): +def test_agent_sessions_get_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_sessions.get("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_sessions.get("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agent_sessions_get_error_403(): +def test_agent_sessions_get_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_sessions.get("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_sessions.get("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_agent_sessions_get_error_404(): +def test_agent_sessions_get_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_sessions.get("test-value") - assert exc_info.value.status == 404 - - -async def test_agent_sessions_update_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_sessions.get("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_sessions_get_success(): + client = _async_client() + try: + result = await client.v1.agent_sessions.get("test-value") + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agent_sessions_get_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_sessions.get("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_sessions_get_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_sessions.get("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_sessions_get_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_sessions.get("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +def test_agent_sessions_update_success(): client = _client() - result = await client.v1.agent_sessions.update("test-value", {}) - assert result is not None + try: + result = client.v1.agent_sessions.update("test-value", {}) + assert result is not None + finally: + client.close() -async def test_agent_sessions_update_error_401(): +def test_agent_sessions_update_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_sessions.update("test-value", {}) - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_sessions.update("test-value", {}) + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agent_sessions_update_error_403(): +def test_agent_sessions_update_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_sessions.update("test-value", {}) - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_sessions.update("test-value", {}) + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_agent_sessions_update_error_404(): +def test_agent_sessions_update_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_sessions.update("test-value", {}) - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_sessions.update("test-value", {}) + assert exc_info.value.status == 404 + finally: + ec.close() -async def test_agent_sessions_update_error_422(): +def test_agent_sessions_update_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_sessions.update("test-value", {}) - assert exc_info.value.status == 422 - - -async def test_agent_sessions_cancel_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_sessions.update("test-value", {}) + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_sessions_update_success(): + client = _async_client() + try: + result = await client.v1.agent_sessions.update("test-value", {}) + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agent_sessions_update_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_sessions.update("test-value", {}) + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_sessions_update_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_sessions.update("test-value", {}) + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_sessions_update_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_sessions.update("test-value", {}) + assert exc_info.value.status == 404 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_sessions_update_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_sessions.update("test-value", {}) + assert exc_info.value.status == 422 + finally: + await ec.close() + + +def test_agent_sessions_cancel_success(): client = _client() - result = await client.v1.agent_sessions.cancel("test-value") - assert result is not None + try: + result = client.v1.agent_sessions.cancel("test-value") + assert result is not None + finally: + client.close() -async def test_agent_sessions_cancel_error_401(): +def test_agent_sessions_cancel_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_sessions.cancel("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_sessions.cancel("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agent_sessions_cancel_error_403(): +def test_agent_sessions_cancel_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_sessions.cancel("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_sessions.cancel("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_agent_sessions_cancel_error_404(): +def test_agent_sessions_cancel_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_sessions.cancel("test-value") - assert exc_info.value.status == 404 - - -async def test_agent_sessions_message_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_sessions.cancel("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_sessions_cancel_success(): + client = _async_client() + try: + result = await client.v1.agent_sessions.cancel("test-value") + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agent_sessions_cancel_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_sessions.cancel("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_sessions_cancel_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_sessions.cancel("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_sessions_cancel_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_sessions.cancel("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +def test_agent_sessions_message_success(): client = _client() - result = await client.v1.agent_sessions.message("test-value", {"content": "test content"}) - assert result is not None + try: + result = client.v1.agent_sessions.message("test-value", {"content": "test content"}) + assert result is not None + finally: + client.close() -async def test_agent_sessions_message_error_401(): +def test_agent_sessions_message_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_sessions.message("test-value", {"content": "test content"}) - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_sessions.message("test-value", {"content": "test content"}) + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agent_sessions_message_error_403(): +def test_agent_sessions_message_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_sessions.message("test-value", {"content": "test content"}) - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_sessions.message("test-value", {"content": "test content"}) + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_agent_sessions_message_error_404(): +def test_agent_sessions_message_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_sessions.message("test-value", {"content": "test content"}) - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_sessions.message("test-value", {"content": "test content"}) + assert exc_info.value.status == 404 + finally: + ec.close() -async def test_agent_sessions_message_error_422(): +def test_agent_sessions_message_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_sessions.message("test-value", {"content": "test content"}) - assert exc_info.value.status == 422 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_sessions.message("test-value", {"content": "test content"}) + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_sessions_message_success(): + client = _async_client() + try: + result = await client.v1.agent_sessions.message("test-value", {"content": "test content"}) + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agent_sessions_message_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_sessions.message("test-value", {"content": "test content"}) + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_sessions_message_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_sessions.message("test-value", {"content": "test content"}) + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_sessions_message_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_sessions.message("test-value", {"content": "test content"}) + assert exc_info.value.status == 404 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_sessions_message_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_sessions.message("test-value", {"content": "test content"}) + assert exc_info.value.status == 422 + finally: + await ec.close() diff --git a/tests/contract/v1/test_agent_skills.py b/tests/contract/v1/test_agent_skills.py index bff3239..216cab4 100644 --- a/tests/contract/v1/test_agent_skills.py +++ b/tests/contract/v1/test_agent_skills.py @@ -1,10 +1,10 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: e51b2cc82b09 +# Content hash: a848df03e938 import pytest -from archastro.platform import PlatformClient +from archastro.platform import AsyncPlatformClient, PlatformClient from archastro.platform.runtime.http_client import ApiError PRISM_URL = "http://127.0.0.1:4040" @@ -26,204 +26,635 @@ def _error_client(code: int) -> PlatformClient: ) -async def test_agent_skills_list_success(): +def _async_client() -> AsyncPlatformClient: + return AsyncPlatformClient( + base_url=PRISM_URL, + default_headers={"x-archastro-api-key": "pk_test-key"}, + access_token="test-token", + ) + + +def _async_error_client(code: int) -> AsyncPlatformClient: + return AsyncPlatformClient( + base_url=PRISM_URL, + default_headers={"x-archastro-api-key": "pk_test-key", "Prefer": f"code={code}"}, + access_token="test-token", + ) + + +def test_agent_skills_list_success(): client = _client() - result = await client.v1.agent_skills.list() - assert result is not None + try: + result = client.v1.agent_skills.list() + assert result is not None + finally: + client.close() -async def test_agent_skills_list_error_401(): +def test_agent_skills_list_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_skills.list() - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_skills.list() + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agent_skills_list_error_403(): +def test_agent_skills_list_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_skills.list() - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_skills.list() + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_agent_skills_list_error_404(): +def test_agent_skills_list_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_skills.list() - assert exc_info.value.status == 404 - - -async def test_agent_skills_create_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_skills.list() + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_skills_list_success(): + client = _async_client() + try: + result = await client.v1.agent_skills.list() + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agent_skills_list_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_skills.list() + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_skills_list_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_skills.list() + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_skills_list_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_skills.list() + assert exc_info.value.status == 404 + finally: + await ec.close() + + +def test_agent_skills_create_success(): client = _client() - result = await client.v1.agent_skills.create({"agent": "test-value", "config": "test-value"}) - assert result is not None + try: + result = client.v1.agent_skills.create({"agent": "test-value", "config": "test-value"}) + assert result is not None + finally: + client.close() -async def test_agent_skills_create_error_401(): +def test_agent_skills_create_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_skills.create({"agent": "test-value", "config": "test-value"}) - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_skills.create({"agent": "test-value", "config": "test-value"}) + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agent_skills_create_error_403(): +def test_agent_skills_create_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_skills.create({"agent": "test-value", "config": "test-value"}) - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_skills.create({"agent": "test-value", "config": "test-value"}) + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_agent_skills_create_error_404(): +def test_agent_skills_create_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_skills.create({"agent": "test-value", "config": "test-value"}) - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_skills.create({"agent": "test-value", "config": "test-value"}) + assert exc_info.value.status == 404 + finally: + ec.close() -async def test_agent_skills_create_error_422(): +def test_agent_skills_create_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_skills.create({"agent": "test-value", "config": "test-value"}) - assert exc_info.value.status == 422 - - -async def test_agent_skills_delete_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_skills.create({"agent": "test-value", "config": "test-value"}) + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_skills_create_success(): + client = _async_client() + try: + result = await client.v1.agent_skills.create( + {"agent": "test-value", "config": "test-value"} + ) + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agent_skills_create_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_skills.create({"agent": "test-value", "config": "test-value"}) + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_skills_create_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_skills.create({"agent": "test-value", "config": "test-value"}) + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_skills_create_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_skills.create({"agent": "test-value", "config": "test-value"}) + assert exc_info.value.status == 404 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_skills_create_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_skills.create({"agent": "test-value", "config": "test-value"}) + assert exc_info.value.status == 422 + finally: + await ec.close() + + +def test_agent_skills_delete_success(): client = _client() - result = await client.v1.agent_skills.delete("test-value") - assert result is None + try: + result = client.v1.agent_skills.delete("test-value") + assert result is None + finally: + client.close() -async def test_agent_skills_delete_error_401(): +def test_agent_skills_delete_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_skills.delete("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_skills.delete("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agent_skills_delete_error_403(): +def test_agent_skills_delete_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_skills.delete("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_skills.delete("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_agent_skills_delete_error_404(): +def test_agent_skills_delete_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_skills.delete("test-value") - assert exc_info.value.status == 404 - - -async def test_agent_skills_get_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_skills.delete("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_skills_delete_success(): + client = _async_client() + try: + result = await client.v1.agent_skills.delete("test-value") + assert result is None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agent_skills_delete_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_skills.delete("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_skills_delete_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_skills.delete("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_skills_delete_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_skills.delete("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +def test_agent_skills_get_success(): client = _client() - result = await client.v1.agent_skills.get("test-value") - assert result is not None + try: + result = client.v1.agent_skills.get("test-value") + assert result is not None + finally: + client.close() -async def test_agent_skills_get_error_401(): +def test_agent_skills_get_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_skills.get("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_skills.get("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agent_skills_get_error_403(): +def test_agent_skills_get_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_skills.get("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_skills.get("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_agent_skills_get_error_404(): +def test_agent_skills_get_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_skills.get("test-value") - assert exc_info.value.status == 404 - - -async def test_agent_skills_update_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_skills.get("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_skills_get_success(): + client = _async_client() + try: + result = await client.v1.agent_skills.get("test-value") + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agent_skills_get_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_skills.get("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_skills_get_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_skills.get("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_skills_get_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_skills.get("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +def test_agent_skills_update_success(): client = _client() - result = await client.v1.agent_skills.update("test-value", {}) - assert result is not None + try: + result = client.v1.agent_skills.update("test-value", {}) + assert result is not None + finally: + client.close() -async def test_agent_skills_update_error_401(): +def test_agent_skills_update_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_skills.update("test-value", {}) - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_skills.update("test-value", {}) + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agent_skills_update_error_403(): +def test_agent_skills_update_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_skills.update("test-value", {}) - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_skills.update("test-value", {}) + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_agent_skills_update_error_404(): +def test_agent_skills_update_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_skills.update("test-value", {}) - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_skills.update("test-value", {}) + assert exc_info.value.status == 404 + finally: + ec.close() -async def test_agent_skills_update_error_422(): +def test_agent_skills_update_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_skills.update("test-value", {}) - assert exc_info.value.status == 422 - - -async def test_agent_skills_activate_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_skills.update("test-value", {}) + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_skills_update_success(): + client = _async_client() + try: + result = await client.v1.agent_skills.update("test-value", {}) + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agent_skills_update_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_skills.update("test-value", {}) + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_skills_update_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_skills.update("test-value", {}) + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_skills_update_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_skills.update("test-value", {}) + assert exc_info.value.status == 404 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_skills_update_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_skills.update("test-value", {}) + assert exc_info.value.status == 422 + finally: + await ec.close() + + +def test_agent_skills_activate_success(): client = _client() - result = await client.v1.agent_skills.activate("test-value") - assert result is not None + try: + result = client.v1.agent_skills.activate("test-value") + assert result is not None + finally: + client.close() -async def test_agent_skills_activate_error_401(): +def test_agent_skills_activate_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_skills.activate("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_skills.activate("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agent_skills_activate_error_403(): +def test_agent_skills_activate_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_skills.activate("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_skills.activate("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_agent_skills_activate_error_404(): +def test_agent_skills_activate_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_skills.activate("test-value") - assert exc_info.value.status == 404 - - -async def test_agent_skills_deactivate_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_skills.activate("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_skills_activate_success(): + client = _async_client() + try: + result = await client.v1.agent_skills.activate("test-value") + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agent_skills_activate_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_skills.activate("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_skills_activate_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_skills.activate("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_skills_activate_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_skills.activate("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +def test_agent_skills_deactivate_success(): client = _client() - result = await client.v1.agent_skills.deactivate("test-value") - assert result is not None + try: + result = client.v1.agent_skills.deactivate("test-value") + assert result is not None + finally: + client.close() -async def test_agent_skills_deactivate_error_401(): +def test_agent_skills_deactivate_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_skills.deactivate("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_skills.deactivate("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agent_skills_deactivate_error_403(): +def test_agent_skills_deactivate_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_skills.deactivate("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_skills.deactivate("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_agent_skills_deactivate_error_404(): +def test_agent_skills_deactivate_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_skills.deactivate("test-value") - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_skills.deactivate("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_skills_deactivate_success(): + client = _async_client() + try: + result = await client.v1.agent_skills.deactivate("test-value") + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agent_skills_deactivate_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_skills.deactivate("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_skills_deactivate_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_skills.deactivate("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_skills_deactivate_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_skills.deactivate("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() diff --git a/tests/contract/v1/test_agent_tools.py b/tests/contract/v1/test_agent_tools.py index e73108a..bde5479 100644 --- a/tests/contract/v1/test_agent_tools.py +++ b/tests/contract/v1/test_agent_tools.py @@ -1,10 +1,10 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: 56ecba915acb +# Content hash: 2360172ee150 import pytest -from archastro.platform import PlatformClient +from archastro.platform import AsyncPlatformClient, PlatformClient from archastro.platform.runtime.http_client import ApiError PRISM_URL = "http://127.0.0.1:4040" @@ -26,197 +26,612 @@ def _error_client(code: int) -> PlatformClient: ) -async def test_agent_tools_list_success(): +def _async_client() -> AsyncPlatformClient: + return AsyncPlatformClient( + base_url=PRISM_URL, + default_headers={"x-archastro-api-key": "pk_test-key"}, + access_token="test-token", + ) + + +def _async_error_client(code: int) -> AsyncPlatformClient: + return AsyncPlatformClient( + base_url=PRISM_URL, + default_headers={"x-archastro-api-key": "pk_test-key", "Prefer": f"code={code}"}, + access_token="test-token", + ) + + +def test_agent_tools_list_success(): client = _client() - result = await client.v1.agent_tools.list() - assert result is not None + try: + result = client.v1.agent_tools.list() + assert result is not None + finally: + client.close() -async def test_agent_tools_list_error_401(): +def test_agent_tools_list_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_tools.list() - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_tools.list() + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agent_tools_list_error_403(): +def test_agent_tools_list_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_tools.list() - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_tools.list() + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_agent_tools_list_error_404(): +def test_agent_tools_list_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_tools.list() - assert exc_info.value.status == 404 - - -async def test_agent_tools_catalog_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_tools.list() + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_tools_list_success(): + client = _async_client() + try: + result = await client.v1.agent_tools.list() + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agent_tools_list_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_tools.list() + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_tools_list_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_tools.list() + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_tools_list_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_tools.list() + assert exc_info.value.status == 404 + finally: + await ec.close() + + +def test_agent_tools_catalog_success(): client = _client() - result = await client.v1.agent_tools.catalog() - assert result is not None + try: + result = client.v1.agent_tools.catalog() + assert result is not None + finally: + client.close() -async def test_agent_tools_catalog_error_401(): +def test_agent_tools_catalog_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_tools.catalog() - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_tools.catalog() + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agent_tools_catalog_error_403(): +def test_agent_tools_catalog_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_tools.catalog() - assert exc_info.value.status == 403 - - -async def test_agent_tools_delete_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_tools.catalog() + assert exc_info.value.status == 403 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_tools_catalog_success(): + client = _async_client() + try: + result = await client.v1.agent_tools.catalog() + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agent_tools_catalog_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_tools.catalog() + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_tools_catalog_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_tools.catalog() + assert exc_info.value.status == 403 + finally: + await ec.close() + + +def test_agent_tools_delete_success(): client = _client() - result = await client.v1.agent_tools.delete("test-value") - assert result is None + try: + result = client.v1.agent_tools.delete("test-value") + assert result is None + finally: + client.close() -async def test_agent_tools_delete_error_401(): +def test_agent_tools_delete_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_tools.delete("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_tools.delete("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agent_tools_delete_error_403(): +def test_agent_tools_delete_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_tools.delete("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_tools.delete("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_agent_tools_delete_error_404(): +def test_agent_tools_delete_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_tools.delete("test-value") - assert exc_info.value.status == 404 - - -async def test_agent_tools_get_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_tools.delete("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_tools_delete_success(): + client = _async_client() + try: + result = await client.v1.agent_tools.delete("test-value") + assert result is None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agent_tools_delete_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_tools.delete("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_tools_delete_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_tools.delete("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_tools_delete_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_tools.delete("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +def test_agent_tools_get_success(): client = _client() - result = await client.v1.agent_tools.get("test-value") - assert result is not None + try: + result = client.v1.agent_tools.get("test-value") + assert result is not None + finally: + client.close() -async def test_agent_tools_get_error_401(): +def test_agent_tools_get_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_tools.get("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_tools.get("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agent_tools_get_error_403(): +def test_agent_tools_get_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_tools.get("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_tools.get("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_agent_tools_get_error_404(): +def test_agent_tools_get_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_tools.get("test-value") - assert exc_info.value.status == 404 - - -async def test_agent_tools_update_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_tools.get("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_tools_get_success(): + client = _async_client() + try: + result = await client.v1.agent_tools.get("test-value") + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agent_tools_get_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_tools.get("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_tools_get_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_tools.get("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_tools_get_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_tools.get("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +def test_agent_tools_update_success(): client = _client() - result = await client.v1.agent_tools.update("test-value", {}) - assert result is not None + try: + result = client.v1.agent_tools.update("test-value", {}) + assert result is not None + finally: + client.close() -async def test_agent_tools_update_error_401(): +def test_agent_tools_update_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_tools.update("test-value", {}) - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_tools.update("test-value", {}) + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agent_tools_update_error_403(): +def test_agent_tools_update_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_tools.update("test-value", {}) - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_tools.update("test-value", {}) + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_agent_tools_update_error_404(): +def test_agent_tools_update_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_tools.update("test-value", {}) - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_tools.update("test-value", {}) + assert exc_info.value.status == 404 + finally: + ec.close() -async def test_agent_tools_update_error_422(): +def test_agent_tools_update_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_tools.update("test-value", {}) - assert exc_info.value.status == 422 - - -async def test_agent_tools_activate_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_tools.update("test-value", {}) + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_tools_update_success(): + client = _async_client() + try: + result = await client.v1.agent_tools.update("test-value", {}) + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agent_tools_update_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_tools.update("test-value", {}) + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_tools_update_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_tools.update("test-value", {}) + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_tools_update_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_tools.update("test-value", {}) + assert exc_info.value.status == 404 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_tools_update_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_tools.update("test-value", {}) + assert exc_info.value.status == 422 + finally: + await ec.close() + + +def test_agent_tools_activate_success(): client = _client() - result = await client.v1.agent_tools.activate("test-value") - assert result is not None + try: + result = client.v1.agent_tools.activate("test-value") + assert result is not None + finally: + client.close() -async def test_agent_tools_activate_error_401(): +def test_agent_tools_activate_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_tools.activate("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_tools.activate("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agent_tools_activate_error_403(): +def test_agent_tools_activate_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_tools.activate("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_tools.activate("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_agent_tools_activate_error_404(): +def test_agent_tools_activate_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_tools.activate("test-value") - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_tools.activate("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() -async def test_agent_tools_activate_error_422(): +def test_agent_tools_activate_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_tools.activate("test-value") - assert exc_info.value.status == 422 - - -async def test_agent_tools_deactivate_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_tools.activate("test-value") + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_tools_activate_success(): + client = _async_client() + try: + result = await client.v1.agent_tools.activate("test-value") + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agent_tools_activate_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_tools.activate("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_tools_activate_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_tools.activate("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_tools_activate_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_tools.activate("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_tools_activate_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_tools.activate("test-value") + assert exc_info.value.status == 422 + finally: + await ec.close() + + +def test_agent_tools_deactivate_success(): client = _client() - result = await client.v1.agent_tools.deactivate("test-value") - assert result is not None + try: + result = client.v1.agent_tools.deactivate("test-value") + assert result is not None + finally: + client.close() -async def test_agent_tools_deactivate_error_401(): +def test_agent_tools_deactivate_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_tools.deactivate("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_tools.deactivate("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agent_tools_deactivate_error_403(): +def test_agent_tools_deactivate_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_tools.deactivate("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_tools.deactivate("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_agent_tools_deactivate_error_404(): +def test_agent_tools_deactivate_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agent_tools.deactivate("test-value") - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agent_tools.deactivate("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_tools_deactivate_success(): + client = _async_client() + try: + result = await client.v1.agent_tools.deactivate("test-value") + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agent_tools_deactivate_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_tools.deactivate("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_tools_deactivate_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_tools.deactivate("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agent_tools_deactivate_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agent_tools.deactivate("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() diff --git a/tests/contract/v1/test_agents.py b/tests/contract/v1/test_agents.py index d09fb25..719cc6a 100644 --- a/tests/contract/v1/test_agents.py +++ b/tests/contract/v1/test_agents.py @@ -1,10 +1,10 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: 7b1e545a0f9f +# Content hash: eb340d907d3d import pytest -from archastro.platform import PlatformClient +from archastro.platform import AsyncPlatformClient, PlatformClient from archastro.platform.runtime.http_client import ApiError PRISM_URL = "http://127.0.0.1:4040" @@ -26,741 +26,2239 @@ def _error_client(code: int) -> PlatformClient: ) -async def test_agents_list_success(): +def _async_client() -> AsyncPlatformClient: + return AsyncPlatformClient( + base_url=PRISM_URL, + default_headers={"x-archastro-api-key": "pk_test-key"}, + access_token="test-token", + ) + + +def _async_error_client(code: int) -> AsyncPlatformClient: + return AsyncPlatformClient( + base_url=PRISM_URL, + default_headers={"x-archastro-api-key": "pk_test-key", "Prefer": f"code={code}"}, + access_token="test-token", + ) + + +def test_agents_list_success(): client = _client() - result = await client.v1.agents.list() - assert result is not None + try: + result = client.v1.agents.list() + assert result is not None + finally: + client.close() -async def test_agents_list_error_401(): +def test_agents_list_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.list() - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.list() + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agents_list_error_403(): +def test_agents_list_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.list() - assert exc_info.value.status == 403 - - -async def test_agents_create_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.list() + assert exc_info.value.status == 403 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_list_success(): + client = _async_client() + try: + result = await client.v1.agents.list() + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agents_list_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.list() + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_list_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.list() + assert exc_info.value.status == 403 + finally: + await ec.close() + + +def test_agents_create_success(): client = _client() - result = await client.v1.agents.create({}) - assert result is not None + try: + result = client.v1.agents.create({}) + assert result is not None + finally: + client.close() -async def test_agents_create_error_400(): +def test_agents_create_error_400(): ec = _error_client(400) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.create({}) - assert exc_info.value.status == 400 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.create({}) + assert exc_info.value.status == 400 + finally: + ec.close() -async def test_agents_create_error_401(): +def test_agents_create_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.create({}) - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.create({}) + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agents_create_error_403(): +def test_agents_create_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.create({}) - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.create({}) + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_agents_create_error_404(): +def test_agents_create_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.create({}) - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.create({}) + assert exc_info.value.status == 404 + finally: + ec.close() -async def test_agents_create_error_409(): +def test_agents_create_error_409(): ec = _error_client(409) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.create({}) - assert exc_info.value.status == 409 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.create({}) + assert exc_info.value.status == 409 + finally: + ec.close() -async def test_agents_create_error_422(): +def test_agents_create_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.create({}) - assert exc_info.value.status == 422 - - -async def test_agents_delete_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.create({}) + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_create_success(): + client = _async_client() + try: + result = await client.v1.agents.create({}) + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agents_create_error_400(): + ec = _async_error_client(400) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.create({}) + assert exc_info.value.status == 400 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_create_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.create({}) + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_create_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.create({}) + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_create_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.create({}) + assert exc_info.value.status == 404 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_create_error_409(): + ec = _async_error_client(409) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.create({}) + assert exc_info.value.status == 409 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_create_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.create({}) + assert exc_info.value.status == 422 + finally: + await ec.close() + + +def test_agents_delete_success(): client = _client() - result = await client.v1.agents.delete("test-value") - assert result is None + try: + result = client.v1.agents.delete("test-value") + assert result is None + finally: + client.close() -async def test_agents_delete_error_401(): +def test_agents_delete_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.delete("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.delete("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agents_delete_error_403(): +def test_agents_delete_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.delete("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.delete("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_agents_delete_error_404(): +def test_agents_delete_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.delete("test-value") - assert exc_info.value.status == 404 - - -async def test_agents_get_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.delete("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_delete_success(): + client = _async_client() + try: + result = await client.v1.agents.delete("test-value") + assert result is None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agents_delete_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.delete("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_delete_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.delete("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_delete_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.delete("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +def test_agents_get_success(): client = _client() - result = await client.v1.agents.get("test-value") - assert result is not None + try: + result = client.v1.agents.get("test-value") + assert result is not None + finally: + client.close() -async def test_agents_get_error_401(): +def test_agents_get_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.get("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.get("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agents_get_error_403(): +def test_agents_get_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.get("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.get("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_agents_get_error_404(): +def test_agents_get_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.get("test-value") - assert exc_info.value.status == 404 - - -async def test_agents_update_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.get("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_get_success(): + client = _async_client() + try: + result = await client.v1.agents.get("test-value") + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agents_get_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.get("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_get_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.get("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_get_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.get("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +def test_agents_update_success(): client = _client() - result = await client.v1.agents.update("test-value", {}) - assert result is not None + try: + result = client.v1.agents.update("test-value", {}) + assert result is not None + finally: + client.close() -async def test_agents_update_error_401(): +def test_agents_update_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.update("test-value", {}) - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.update("test-value", {}) + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agents_update_error_403(): +def test_agents_update_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.update("test-value", {}) - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.update("test-value", {}) + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_agents_update_error_404(): +def test_agents_update_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.update("test-value", {}) - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.update("test-value", {}) + assert exc_info.value.status == 404 + finally: + ec.close() -async def test_agents_update_error_422(): +def test_agents_update_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.update("test-value", {}) - assert exc_info.value.status == 422 - - -async def test_agents_agent_health_actions_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.update("test-value", {}) + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_update_success(): + client = _async_client() + try: + result = await client.v1.agents.update("test-value", {}) + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agents_update_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.update("test-value", {}) + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_update_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.update("test-value", {}) + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_update_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.update("test-value", {}) + assert exc_info.value.status == 404 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_update_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.update("test-value", {}) + assert exc_info.value.status == 422 + finally: + await ec.close() + + +def test_agents_agent_health_actions_success(): client = _client() - result = await client.v1.agents.agent_health_actions("test-value") - assert result is not None + try: + result = client.v1.agents.agent_health_actions("test-value") + assert result is not None + finally: + client.close() -async def test_agents_agent_health_actions_error_401(): +def test_agents_agent_health_actions_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.agent_health_actions("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.agent_health_actions("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agents_agent_health_actions_error_403(): +def test_agents_agent_health_actions_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.agent_health_actions("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.agent_health_actions("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_agents_agent_health_actions_error_404(): +def test_agents_agent_health_actions_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.agent_health_actions("test-value") - assert exc_info.value.status == 404 - - -async def test_agents_agent_routines_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.agent_health_actions("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_agent_health_actions_success(): + client = _async_client() + try: + result = await client.v1.agents.agent_health_actions("test-value") + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agents_agent_health_actions_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.agent_health_actions("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_agent_health_actions_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.agent_health_actions("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_agent_health_actions_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.agent_health_actions("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +def test_agents_agent_routines_success(): client = _client() - result = await client.v1.agents.agent_routines( - "test-value", {"handler_type": "test-value", "name": "test-name"} - ) - assert result is not None + try: + result = client.v1.agents.agent_routines( + "test-value", {"handler_type": "test-value", "name": "test-name"} + ) + assert result is not None + finally: + client.close() -async def test_agents_agent_routines_error_401(): +def test_agents_agent_routines_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.agent_routines( - "test-value", {"handler_type": "test-value", "name": "test-name"} - ) - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.agent_routines( + "test-value", {"handler_type": "test-value", "name": "test-name"} + ) + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agents_agent_routines_error_403(): +def test_agents_agent_routines_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.agent_routines( - "test-value", {"handler_type": "test-value", "name": "test-name"} - ) - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.agent_routines( + "test-value", {"handler_type": "test-value", "name": "test-name"} + ) + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_agents_agent_routines_error_404(): +def test_agents_agent_routines_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.agent_routines( - "test-value", {"handler_type": "test-value", "name": "test-name"} - ) - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.agent_routines( + "test-value", {"handler_type": "test-value", "name": "test-name"} + ) + assert exc_info.value.status == 404 + finally: + ec.close() -async def test_agents_agent_routines_error_422(): +def test_agents_agent_routines_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.agent_routines( + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.agent_routines( + "test-value", {"handler_type": "test-value", "name": "test-name"} + ) + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_agent_routines_success(): + client = _async_client() + try: + result = await client.v1.agents.agent_routines( "test-value", {"handler_type": "test-value", "name": "test-name"} ) - assert exc_info.value.status == 422 - - -async def test_agents_agent_working_memory_success(): + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agents_agent_routines_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.agent_routines( + "test-value", {"handler_type": "test-value", "name": "test-name"} + ) + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_agent_routines_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.agent_routines( + "test-value", {"handler_type": "test-value", "name": "test-name"} + ) + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_agent_routines_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.agent_routines( + "test-value", {"handler_type": "test-value", "name": "test-name"} + ) + assert exc_info.value.status == 404 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_agent_routines_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.agent_routines( + "test-value", {"handler_type": "test-value", "name": "test-name"} + ) + assert exc_info.value.status == 422 + finally: + await ec.close() + + +def test_agents_agent_working_memory_success(): client = _client() - result = await client.v1.agents.agent_working_memory("test-value") - assert result is not None + try: + result = client.v1.agents.agent_working_memory("test-value") + assert result is not None + finally: + client.close() -async def test_agents_agent_working_memory_error_401(): +def test_agents_agent_working_memory_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.agent_working_memory("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.agent_working_memory("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agents_agent_working_memory_error_403(): +def test_agents_agent_working_memory_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.agent_working_memory("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.agent_working_memory("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_agents_agent_working_memory_error_404(): +def test_agents_agent_working_memory_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.agent_working_memory("test-value") - assert exc_info.value.status == 404 - - -async def test_agents_export_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.agent_working_memory("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_agent_working_memory_success(): + client = _async_client() + try: + result = await client.v1.agents.agent_working_memory("test-value") + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agents_agent_working_memory_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.agent_working_memory("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_agent_working_memory_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.agent_working_memory("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_agent_working_memory_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.agent_working_memory("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +def test_agents_export_success(): client = _client() - result = await client.v1.agents.export("test-value") - assert result is not None + try: + result = client.v1.agents.export("test-value") + assert result is not None + finally: + client.close() -async def test_agents_export_error_401(): +def test_agents_export_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.export("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.export("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agents_export_error_403(): +def test_agents_export_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.export("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.export("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_agents_export_error_404(): +def test_agents_export_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.export("test-value") - assert exc_info.value.status == 404 - - -async def test_agents_health_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.export("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_export_success(): + client = _async_client() + try: + result = await client.v1.agents.export("test-value") + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agents_export_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.export("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_export_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.export("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_export_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.export("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +def test_agents_health_success(): client = _client() - result = await client.v1.agents.health("test-value") - assert result is not None + try: + result = client.v1.agents.health("test-value") + assert result is not None + finally: + client.close() -async def test_agents_health_error_401(): +def test_agents_health_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.health("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.health("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agents_health_error_403(): +def test_agents_health_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.health("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.health("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_agents_health_error_404(): +def test_agents_health_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.health("test-value") - assert exc_info.value.status == 404 - - -async def test_agents_search_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.health("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_health_success(): + client = _async_client() + try: + result = await client.v1.agents.health("test-value") + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agents_health_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.health("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_health_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.health("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_health_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.health("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +def test_agents_search_success(): client = _client() - result = await client.v1.agents.search("test-value", {"query": "test-value"}) - assert result is not None - assert "data" in result - assert isinstance(result["data"], list) + try: + result = client.v1.agents.search("test-value", {"query": "test-value"}) + assert result is not None + assert "data" in result + assert isinstance(result["data"], list) + finally: + client.close() -async def test_agents_search_error_401(): +def test_agents_search_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.search("test-value", {"query": "test-value"}) - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.search("test-value", {"query": "test-value"}) + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agents_search_error_404(): +def test_agents_search_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.search("test-value", {"query": "test-value"}) - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.search("test-value", {"query": "test-value"}) + assert exc_info.value.status == 404 + finally: + ec.close() -async def test_agents_search_error_422(): +def test_agents_search_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.search("test-value", {"query": "test-value"}) - assert exc_info.value.status == 422 - - -async def test_agents_threads_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.search("test-value", {"query": "test-value"}) + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_search_success(): + client = _async_client() + try: + result = await client.v1.agents.search("test-value", {"query": "test-value"}) + assert result is not None + assert "data" in result + assert isinstance(result["data"], list) + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agents_search_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.search("test-value", {"query": "test-value"}) + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_search_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.search("test-value", {"query": "test-value"}) + assert exc_info.value.status == 404 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_search_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.search("test-value", {"query": "test-value"}) + assert exc_info.value.status == 422 + finally: + await ec.close() + + +def test_agents_threads_success(): client = _client() - result = await client.v1.agents.threads("test-value", {"thread": {}}) - assert result is not None + try: + result = client.v1.agents.threads("test-value", {"thread": {}}) + assert result is not None + finally: + client.close() -async def test_agents_threads_error_401(): +def test_agents_threads_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.threads("test-value", {"thread": {}}) - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.threads("test-value", {"thread": {}}) + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agents_threads_error_403(): +def test_agents_threads_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.threads("test-value", {"thread": {}}) - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.threads("test-value", {"thread": {}}) + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_agents_threads_error_404(): +def test_agents_threads_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.threads("test-value", {"thread": {}}) - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.threads("test-value", {"thread": {}}) + assert exc_info.value.status == 404 + finally: + ec.close() -async def test_agents_threads_error_422(): +def test_agents_threads_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.threads("test-value", {"thread": {}}) - assert exc_info.value.status == 422 - - -async def test_agents_upgrade_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.threads("test-value", {"thread": {}}) + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_threads_success(): + client = _async_client() + try: + result = await client.v1.agents.threads("test-value", {"thread": {}}) + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agents_threads_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.threads("test-value", {"thread": {}}) + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_threads_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.threads("test-value", {"thread": {}}) + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_threads_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.threads("test-value", {"thread": {}}) + assert exc_info.value.status == 404 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_threads_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.threads("test-value", {"thread": {}}) + assert exc_info.value.status == 422 + finally: + await ec.close() + + +def test_agents_upgrade_success(): client = _client() - result = await client.v1.agents.upgrade("test-value", {}) - assert result is not None + try: + result = client.v1.agents.upgrade("test-value", {}) + assert result is not None + finally: + client.close() -async def test_agents_upgrade_error_400(): +def test_agents_upgrade_error_400(): ec = _error_client(400) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.upgrade("test-value", {}) - assert exc_info.value.status == 400 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.upgrade("test-value", {}) + assert exc_info.value.status == 400 + finally: + ec.close() -async def test_agents_upgrade_error_401(): +def test_agents_upgrade_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.upgrade("test-value", {}) - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.upgrade("test-value", {}) + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agents_upgrade_error_403(): +def test_agents_upgrade_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.upgrade("test-value", {}) - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.upgrade("test-value", {}) + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_agents_upgrade_error_404(): +def test_agents_upgrade_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.upgrade("test-value", {}) - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.upgrade("test-value", {}) + assert exc_info.value.status == 404 + finally: + ec.close() -async def test_agents_upgrade_error_422(): +def test_agents_upgrade_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.upgrade("test-value", {}) - assert exc_info.value.status == 422 - - -async def test_agents_agent_computers_list_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.upgrade("test-value", {}) + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_upgrade_success(): + client = _async_client() + try: + result = await client.v1.agents.upgrade("test-value", {}) + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agents_upgrade_error_400(): + ec = _async_error_client(400) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.upgrade("test-value", {}) + assert exc_info.value.status == 400 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_upgrade_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.upgrade("test-value", {}) + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_upgrade_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.upgrade("test-value", {}) + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_upgrade_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.upgrade("test-value", {}) + assert exc_info.value.status == 404 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_upgrade_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.upgrade("test-value", {}) + assert exc_info.value.status == 422 + finally: + await ec.close() + + +def test_agents_agent_computers_list_success(): client = _client() - result = await client.v1.agents.agent_computers.list("test-value") - assert result is not None + try: + result = client.v1.agents.agent_computers.list("test-value") + assert result is not None + finally: + client.close() -async def test_agents_agent_computers_list_error_401(): +def test_agents_agent_computers_list_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.agent_computers.list("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.agent_computers.list("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agents_agent_computers_list_error_403(): +def test_agents_agent_computers_list_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.agent_computers.list("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.agent_computers.list("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_agents_agent_computers_list_error_404(): +def test_agents_agent_computers_list_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.agent_computers.list("test-value") - assert exc_info.value.status == 404 - - -async def test_agents_agent_computers_create_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.agent_computers.list("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_agent_computers_list_success(): + client = _async_client() + try: + result = await client.v1.agents.agent_computers.list("test-value") + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agents_agent_computers_list_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.agent_computers.list("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_agent_computers_list_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.agent_computers.list("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_agent_computers_list_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.agent_computers.list("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +def test_agents_agent_computers_create_success(): client = _client() - result = await client.v1.agents.agent_computers.create("test-value", {"name": "test-name"}) - assert result is not None + try: + result = client.v1.agents.agent_computers.create("test-value", {"name": "test-name"}) + assert result is not None + finally: + client.close() -async def test_agents_agent_computers_create_error_401(): +def test_agents_agent_computers_create_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.agent_computers.create("test-value", {"name": "test-name"}) - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.agent_computers.create("test-value", {"name": "test-name"}) + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agents_agent_computers_create_error_403(): +def test_agents_agent_computers_create_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.agent_computers.create("test-value", {"name": "test-name"}) - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.agent_computers.create("test-value", {"name": "test-name"}) + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_agents_agent_computers_create_error_404(): +def test_agents_agent_computers_create_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.agent_computers.create("test-value", {"name": "test-name"}) - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.agent_computers.create("test-value", {"name": "test-name"}) + assert exc_info.value.status == 404 + finally: + ec.close() -async def test_agents_agent_computers_create_error_422(): +def test_agents_agent_computers_create_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.agent_computers.create("test-value", {"name": "test-name"}) - assert exc_info.value.status == 422 - - -async def test_agents_agent_env_vars_list_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.agent_computers.create("test-value", {"name": "test-name"}) + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_agent_computers_create_success(): + client = _async_client() + try: + result = await client.v1.agents.agent_computers.create("test-value", {"name": "test-name"}) + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agents_agent_computers_create_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.agent_computers.create("test-value", {"name": "test-name"}) + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_agent_computers_create_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.agent_computers.create("test-value", {"name": "test-name"}) + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_agent_computers_create_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.agent_computers.create("test-value", {"name": "test-name"}) + assert exc_info.value.status == 404 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_agent_computers_create_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.agent_computers.create("test-value", {"name": "test-name"}) + assert exc_info.value.status == 422 + finally: + await ec.close() + + +def test_agents_agent_env_vars_list_success(): client = _client() - result = await client.v1.agents.agent_env_vars.list("test-value") - assert result is not None + try: + result = client.v1.agents.agent_env_vars.list("test-value") + assert result is not None + finally: + client.close() -async def test_agents_agent_env_vars_list_error_401(): +def test_agents_agent_env_vars_list_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.agent_env_vars.list("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.agent_env_vars.list("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agents_agent_env_vars_list_error_403(): +def test_agents_agent_env_vars_list_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.agent_env_vars.list("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.agent_env_vars.list("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_agents_agent_env_vars_list_error_404(): +def test_agents_agent_env_vars_list_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.agent_env_vars.list("test-value") - assert exc_info.value.status == 404 - - -async def test_agents_agent_env_vars_create_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.agent_env_vars.list("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_agent_env_vars_list_success(): + client = _async_client() + try: + result = await client.v1.agents.agent_env_vars.list("test-value") + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agents_agent_env_vars_list_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.agent_env_vars.list("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_agent_env_vars_list_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.agent_env_vars.list("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_agent_env_vars_list_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.agent_env_vars.list("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +def test_agents_agent_env_vars_create_success(): client = _client() - result = await client.v1.agents.agent_env_vars.create( - "test-value", {"key": "test-key", "value": "test-value"} - ) - assert result is not None + try: + result = client.v1.agents.agent_env_vars.create( + "test-value", {"key": "test-key", "value": "test-value"} + ) + assert result is not None + finally: + client.close() -async def test_agents_agent_env_vars_create_error_401(): +def test_agents_agent_env_vars_create_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.agent_env_vars.create( - "test-value", {"key": "test-key", "value": "test-value"} - ) - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.agent_env_vars.create( + "test-value", {"key": "test-key", "value": "test-value"} + ) + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agents_agent_env_vars_create_error_403(): +def test_agents_agent_env_vars_create_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.agent_env_vars.create( - "test-value", {"key": "test-key", "value": "test-value"} - ) - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.agent_env_vars.create( + "test-value", {"key": "test-key", "value": "test-value"} + ) + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_agents_agent_env_vars_create_error_404(): +def test_agents_agent_env_vars_create_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.agent_env_vars.create( - "test-value", {"key": "test-key", "value": "test-value"} - ) - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.agent_env_vars.create( + "test-value", {"key": "test-key", "value": "test-value"} + ) + assert exc_info.value.status == 404 + finally: + ec.close() -async def test_agents_agent_env_vars_create_error_422(): +def test_agents_agent_env_vars_create_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.agent_env_vars.create( + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.agent_env_vars.create( + "test-value", {"key": "test-key", "value": "test-value"} + ) + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_agent_env_vars_create_success(): + client = _async_client() + try: + result = await client.v1.agents.agent_env_vars.create( "test-value", {"key": "test-key", "value": "test-value"} ) - assert exc_info.value.status == 422 - - -async def test_agents_agent_installations_list_success(): + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agents_agent_env_vars_create_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.agent_env_vars.create( + "test-value", {"key": "test-key", "value": "test-value"} + ) + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_agent_env_vars_create_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.agent_env_vars.create( + "test-value", {"key": "test-key", "value": "test-value"} + ) + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_agent_env_vars_create_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.agent_env_vars.create( + "test-value", {"key": "test-key", "value": "test-value"} + ) + assert exc_info.value.status == 404 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_agent_env_vars_create_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.agent_env_vars.create( + "test-value", {"key": "test-key", "value": "test-value"} + ) + assert exc_info.value.status == 422 + finally: + await ec.close() + + +def test_agents_agent_installations_list_success(): client = _client() - result = await client.v1.agents.agent_installations.list("test-value") - assert result is not None + try: + result = client.v1.agents.agent_installations.list("test-value") + assert result is not None + finally: + client.close() -async def test_agents_agent_installations_list_error_401(): +def test_agents_agent_installations_list_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.agent_installations.list("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.agent_installations.list("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agents_agent_installations_list_error_403(): +def test_agents_agent_installations_list_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.agent_installations.list("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.agent_installations.list("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_agents_agent_installations_list_error_404(): +def test_agents_agent_installations_list_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.agent_installations.list("test-value") - assert exc_info.value.status == 404 - - -async def test_agents_agent_installations_create_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.agent_installations.list("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_agent_installations_list_success(): + client = _async_client() + try: + result = await client.v1.agents.agent_installations.list("test-value") + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agents_agent_installations_list_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.agent_installations.list("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_agent_installations_list_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.agent_installations.list("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_agent_installations_list_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.agent_installations.list("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +def test_agents_agent_installations_create_success(): client = _client() - result = await client.v1.agents.agent_installations.create("test-value", {"kind": "test"}) - assert result is not None + try: + result = client.v1.agents.agent_installations.create("test-value", {"kind": "test"}) + assert result is not None + finally: + client.close() -async def test_agents_agent_installations_create_error_401(): +def test_agents_agent_installations_create_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.agent_installations.create("test-value", {"kind": "test"}) - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.agent_installations.create("test-value", {"kind": "test"}) + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agents_agent_installations_create_error_403(): +def test_agents_agent_installations_create_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.agent_installations.create("test-value", {"kind": "test"}) - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.agent_installations.create("test-value", {"kind": "test"}) + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_agents_agent_installations_create_error_404(): +def test_agents_agent_installations_create_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.agent_installations.create("test-value", {"kind": "test"}) - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.agent_installations.create("test-value", {"kind": "test"}) + assert exc_info.value.status == 404 + finally: + ec.close() -async def test_agents_agent_installations_create_error_422(): +def test_agents_agent_installations_create_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.agent_installations.create("test-value", {"kind": "test"}) - assert exc_info.value.status == 422 - - -async def test_agents_agent_installations_kinds_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.agent_installations.create("test-value", {"kind": "test"}) + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_agent_installations_create_success(): + client = _async_client() + try: + result = await client.v1.agents.agent_installations.create("test-value", {"kind": "test"}) + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agents_agent_installations_create_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.agent_installations.create("test-value", {"kind": "test"}) + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_agent_installations_create_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.agent_installations.create("test-value", {"kind": "test"}) + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_agent_installations_create_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.agent_installations.create("test-value", {"kind": "test"}) + assert exc_info.value.status == 404 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_agent_installations_create_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.agent_installations.create("test-value", {"kind": "test"}) + assert exc_info.value.status == 422 + finally: + await ec.close() + + +def test_agents_agent_installations_kinds_success(): client = _client() - result = await client.v1.agents.agent_installations.kinds("test-value") - assert result is not None + try: + result = client.v1.agents.agent_installations.kinds("test-value") + assert result is not None + finally: + client.close() -async def test_agents_agent_installations_kinds_error_401(): +def test_agents_agent_installations_kinds_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.agent_installations.kinds("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.agent_installations.kinds("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agents_agent_installations_kinds_error_403(): +def test_agents_agent_installations_kinds_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.agent_installations.kinds("test-value") - assert exc_info.value.status == 403 - - -async def test_agents_agent_tools_list_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.agent_installations.kinds("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_agent_installations_kinds_success(): + client = _async_client() + try: + result = await client.v1.agents.agent_installations.kinds("test-value") + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agents_agent_installations_kinds_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.agent_installations.kinds("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_agent_installations_kinds_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.agent_installations.kinds("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +def test_agents_agent_tools_list_success(): client = _client() - result = await client.v1.agents.agent_tools.list("test-value") - assert result is not None + try: + result = client.v1.agents.agent_tools.list("test-value") + assert result is not None + finally: + client.close() -async def test_agents_agent_tools_list_error_401(): +def test_agents_agent_tools_list_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.agent_tools.list("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.agent_tools.list("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agents_agent_tools_list_error_403(): +def test_agents_agent_tools_list_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.agent_tools.list("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.agent_tools.list("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_agents_agent_tools_list_error_404(): +def test_agents_agent_tools_list_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.agent_tools.list("test-value") - assert exc_info.value.status == 404 - - -async def test_agents_agent_tools_create_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.agent_tools.list("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_agent_tools_list_success(): + client = _async_client() + try: + result = await client.v1.agents.agent_tools.list("test-value") + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agents_agent_tools_list_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.agent_tools.list("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_agent_tools_list_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.agent_tools.list("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_agent_tools_list_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.agent_tools.list("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +def test_agents_agent_tools_create_success(): client = _client() - result = await client.v1.agents.agent_tools.create("test-value", {"kind": "test"}) - assert result is not None + try: + result = client.v1.agents.agent_tools.create("test-value", {"kind": "test"}) + assert result is not None + finally: + client.close() -async def test_agents_agent_tools_create_error_401(): +def test_agents_agent_tools_create_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.agent_tools.create("test-value", {"kind": "test"}) - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.agent_tools.create("test-value", {"kind": "test"}) + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agents_agent_tools_create_error_403(): +def test_agents_agent_tools_create_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.agent_tools.create("test-value", {"kind": "test"}) - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.agent_tools.create("test-value", {"kind": "test"}) + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_agents_agent_tools_create_error_404(): +def test_agents_agent_tools_create_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.agent_tools.create("test-value", {"kind": "test"}) - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.agent_tools.create("test-value", {"kind": "test"}) + assert exc_info.value.status == 404 + finally: + ec.close() -async def test_agents_agent_tools_create_error_422(): +def test_agents_agent_tools_create_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.agent_tools.create("test-value", {"kind": "test"}) - assert exc_info.value.status == 422 - - -async def test_agents_schedules_list_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.agent_tools.create("test-value", {"kind": "test"}) + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_agent_tools_create_success(): + client = _async_client() + try: + result = await client.v1.agents.agent_tools.create("test-value", {"kind": "test"}) + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agents_agent_tools_create_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.agent_tools.create("test-value", {"kind": "test"}) + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_agent_tools_create_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.agent_tools.create("test-value", {"kind": "test"}) + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_agent_tools_create_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.agent_tools.create("test-value", {"kind": "test"}) + assert exc_info.value.status == 404 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_agent_tools_create_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.agent_tools.create("test-value", {"kind": "test"}) + assert exc_info.value.status == 422 + finally: + await ec.close() + + +def test_agents_schedules_list_success(): client = _client() - result = await client.v1.agents.schedules.list("test-value") - assert result is not None + try: + result = client.v1.agents.schedules.list("test-value") + assert result is not None + finally: + client.close() -async def test_agents_schedules_list_error_400(): +def test_agents_schedules_list_error_400(): ec = _error_client(400) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.schedules.list("test-value") - assert exc_info.value.status == 400 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.schedules.list("test-value") + assert exc_info.value.status == 400 + finally: + ec.close() -async def test_agents_schedules_list_error_401(): +def test_agents_schedules_list_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.schedules.list("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.schedules.list("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agents_schedules_list_error_403(): +def test_agents_schedules_list_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.schedules.list("test-value") - assert exc_info.value.status == 403 - - -async def test_agents_schedules_get_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.schedules.list("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_schedules_list_success(): + client = _async_client() + try: + result = await client.v1.agents.schedules.list("test-value") + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agents_schedules_list_error_400(): + ec = _async_error_client(400) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.schedules.list("test-value") + assert exc_info.value.status == 400 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_schedules_list_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.schedules.list("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_schedules_list_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.schedules.list("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +def test_agents_schedules_get_success(): client = _client() - result = await client.v1.agents.schedules.get("test-value", "test-value") - assert result is not None + try: + result = client.v1.agents.schedules.get("test-value", "test-value") + assert result is not None + finally: + client.close() -async def test_agents_schedules_get_error_401(): +def test_agents_schedules_get_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.schedules.get("test-value", "test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.schedules.get("test-value", "test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_agents_schedules_get_error_403(): +def test_agents_schedules_get_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.schedules.get("test-value", "test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.schedules.get("test-value", "test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_agents_schedules_get_error_404(): +def test_agents_schedules_get_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.agents.schedules.get("test-value", "test-value") - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.agents.schedules.get("test-value", "test-value") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_schedules_get_success(): + client = _async_client() + try: + result = await client.v1.agents.schedules.get("test-value", "test-value") + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_agents_schedules_get_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.schedules.get("test-value", "test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_schedules_get_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.schedules.get("test-value", "test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_agents_schedules_get_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.agents.schedules.get("test-value", "test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() diff --git a/tests/contract/v1/test_ai.py b/tests/contract/v1/test_ai.py index f8bd063..d0867ea 100644 --- a/tests/contract/v1/test_ai.py +++ b/tests/contract/v1/test_ai.py @@ -1,10 +1,10 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: fd8c631f9a47 +# Content hash: dc69ee2e9657 import pytest -from archastro.platform import PlatformClient +from archastro.platform import AsyncPlatformClient, PlatformClient from archastro.platform.runtime.http_client import ApiError PRISM_URL = "http://127.0.0.1:4040" @@ -26,149 +26,432 @@ def _error_client(code: int) -> PlatformClient: ) -async def test_ai_chat_completions_success(): - client = _client() - result = await client.v1.ai.chat.completions( - {"messages": [{"role": "user"}], "opts": {"model": "test-model"}} +def _async_client() -> AsyncPlatformClient: + return AsyncPlatformClient( + base_url=PRISM_URL, + default_headers={"x-archastro-api-key": "pk_test-key"}, + access_token="test-token", ) - assert result is not None -async def test_ai_chat_completions_error_400(): - ec = _error_client(400) - with pytest.raises(ApiError) as exc_info: - await ec.v1.ai.chat.completions( +def _async_error_client(code: int) -> AsyncPlatformClient: + return AsyncPlatformClient( + base_url=PRISM_URL, + default_headers={"x-archastro-api-key": "pk_test-key", "Prefer": f"code={code}"}, + access_token="test-token", + ) + + +def test_ai_chat_completions_success(): + client = _client() + try: + result = client.v1.ai.chat.completions( {"messages": [{"role": "user"}], "opts": {"model": "test-model"}} ) - assert exc_info.value.status == 400 + assert result is not None + finally: + client.close() + + +def test_ai_chat_completions_error_400(): + ec = _error_client(400) + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.ai.chat.completions( + {"messages": [{"role": "user"}], "opts": {"model": "test-model"}} + ) + assert exc_info.value.status == 400 + finally: + ec.close() -async def test_ai_chat_completions_error_401(): +def test_ai_chat_completions_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.ai.chat.completions( - {"messages": [{"role": "user"}], "opts": {"model": "test-model"}} - ) - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.ai.chat.completions( + {"messages": [{"role": "user"}], "opts": {"model": "test-model"}} + ) + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_ai_chat_completions_error_402(): +def test_ai_chat_completions_error_402(): ec = _error_client(402) - with pytest.raises(ApiError) as exc_info: - await ec.v1.ai.chat.completions( - {"messages": [{"role": "user"}], "opts": {"model": "test-model"}} - ) - assert exc_info.value.status == 402 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.ai.chat.completions( + {"messages": [{"role": "user"}], "opts": {"model": "test-model"}} + ) + assert exc_info.value.status == 402 + finally: + ec.close() -async def test_ai_chat_completions_error_422(): +def test_ai_chat_completions_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.ai.chat.completions( + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.ai.chat.completions( + {"messages": [{"role": "user"}], "opts": {"model": "test-model"}} + ) + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_ai_chat_completions_success(): + client = _async_client() + try: + result = await client.v1.ai.chat.completions( {"messages": [{"role": "user"}], "opts": {"model": "test-model"}} ) - assert exc_info.value.status == 422 - - -async def test_ai_chat_models_success(): + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_ai_chat_completions_error_400(): + ec = _async_error_client(400) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.ai.chat.completions( + {"messages": [{"role": "user"}], "opts": {"model": "test-model"}} + ) + assert exc_info.value.status == 400 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_ai_chat_completions_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.ai.chat.completions( + {"messages": [{"role": "user"}], "opts": {"model": "test-model"}} + ) + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_ai_chat_completions_error_402(): + ec = _async_error_client(402) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.ai.chat.completions( + {"messages": [{"role": "user"}], "opts": {"model": "test-model"}} + ) + assert exc_info.value.status == 402 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_ai_chat_completions_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.ai.chat.completions( + {"messages": [{"role": "user"}], "opts": {"model": "test-model"}} + ) + assert exc_info.value.status == 422 + finally: + await ec.close() + + +def test_ai_chat_models_success(): client = _client() - result = await client.v1.ai.chat.models() - assert result is not None - assert "data" in result - assert isinstance(result["data"], list) + try: + result = client.v1.ai.chat.models() + assert result is not None + assert "data" in result + assert isinstance(result["data"], list) + finally: + client.close() -async def test_ai_chat_models_error_401(): +def test_ai_chat_models_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.ai.chat.models() - assert exc_info.value.status == 401 - - -async def test_ai_image_edits_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.ai.chat.models() + assert exc_info.value.status == 401 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_ai_chat_models_success(): + client = _async_client() + try: + result = await client.v1.ai.chat.models() + assert result is not None + assert "data" in result + assert isinstance(result["data"], list) + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_ai_chat_models_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.ai.chat.models() + assert exc_info.value.status == 401 + finally: + await ec.close() + + +def test_ai_image_edits_success(): client = _client() - result = await client.v1.ai.image.edits( - { - "images": [{"image_data": "test-value", "image_type": "test-value"}], - "prompt": "test-value", - } - ) - assert result is not None - - -async def test_ai_image_edits_error_400(): - ec = _error_client(400) - with pytest.raises(ApiError) as exc_info: - await ec.v1.ai.image.edits( + try: + result = client.v1.ai.image.edits( { "images": [{"image_data": "test-value", "image_type": "test-value"}], "prompt": "test-value", } ) - assert exc_info.value.status == 400 + assert result is not None + finally: + client.close() -async def test_ai_image_edits_error_401(): +def test_ai_image_edits_error_400(): + ec = _error_client(400) + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.ai.image.edits( + { + "images": [{"image_data": "test-value", "image_type": "test-value"}], + "prompt": "test-value", + } + ) + assert exc_info.value.status == 400 + finally: + ec.close() + + +def test_ai_image_edits_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.ai.image.edits( - { - "images": [{"image_data": "test-value", "image_type": "test-value"}], - "prompt": "test-value", - } - ) - assert exc_info.value.status == 401 - - -async def test_ai_image_edits_error_422(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.ai.image.edits( + { + "images": [{"image_data": "test-value", "image_type": "test-value"}], + "prompt": "test-value", + } + ) + assert exc_info.value.status == 401 + finally: + ec.close() + + +def test_ai_image_edits_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.ai.image.edits( + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.ai.image.edits( + { + "images": [{"image_data": "test-value", "image_type": "test-value"}], + "prompt": "test-value", + } + ) + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_ai_image_edits_success(): + client = _async_client() + try: + result = await client.v1.ai.image.edits( { "images": [{"image_data": "test-value", "image_type": "test-value"}], "prompt": "test-value", } ) - assert exc_info.value.status == 422 - - -async def test_ai_image_generations_success(): + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_ai_image_edits_error_400(): + ec = _async_error_client(400) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.ai.image.edits( + { + "images": [{"image_data": "test-value", "image_type": "test-value"}], + "prompt": "test-value", + } + ) + assert exc_info.value.status == 400 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_ai_image_edits_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.ai.image.edits( + { + "images": [{"image_data": "test-value", "image_type": "test-value"}], + "prompt": "test-value", + } + ) + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_ai_image_edits_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.ai.image.edits( + { + "images": [{"image_data": "test-value", "image_type": "test-value"}], + "prompt": "test-value", + } + ) + assert exc_info.value.status == 422 + finally: + await ec.close() + + +def test_ai_image_generations_success(): client = _client() - result = await client.v1.ai.image.generations({"prompt": "test-value"}) - assert result is not None + try: + result = client.v1.ai.image.generations({"prompt": "test-value"}) + assert result is not None + finally: + client.close() -async def test_ai_image_generations_error_400(): +def test_ai_image_generations_error_400(): ec = _error_client(400) - with pytest.raises(ApiError) as exc_info: - await ec.v1.ai.image.generations({"prompt": "test-value"}) - assert exc_info.value.status == 400 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.ai.image.generations({"prompt": "test-value"}) + assert exc_info.value.status == 400 + finally: + ec.close() -async def test_ai_image_generations_error_401(): +def test_ai_image_generations_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.ai.image.generations({"prompt": "test-value"}) - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.ai.image.generations({"prompt": "test-value"}) + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_ai_image_generations_error_422(): +def test_ai_image_generations_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.ai.image.generations({"prompt": "test-value"}) - assert exc_info.value.status == 422 - - -async def test_ai_image_models_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.ai.image.generations({"prompt": "test-value"}) + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_ai_image_generations_success(): + client = _async_client() + try: + result = await client.v1.ai.image.generations({"prompt": "test-value"}) + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_ai_image_generations_error_400(): + ec = _async_error_client(400) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.ai.image.generations({"prompt": "test-value"}) + assert exc_info.value.status == 400 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_ai_image_generations_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.ai.image.generations({"prompt": "test-value"}) + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_ai_image_generations_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.ai.image.generations({"prompt": "test-value"}) + assert exc_info.value.status == 422 + finally: + await ec.close() + + +def test_ai_image_models_success(): client = _client() - result = await client.v1.ai.image.models() - assert result is not None - assert "data" in result - assert isinstance(result["data"], list) + try: + result = client.v1.ai.image.models() + assert result is not None + assert "data" in result + assert isinstance(result["data"], list) + finally: + client.close() -async def test_ai_image_models_error_401(): +def test_ai_image_models_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.ai.image.models() - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.ai.image.models() + assert exc_info.value.status == 401 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_ai_image_models_success(): + client = _async_client() + try: + result = await client.v1.ai.image.models() + assert result is not None + assert "data" in result + assert isinstance(result["data"], list) + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_ai_image_models_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.ai.image.models() + assert exc_info.value.status == 401 + finally: + await ec.close() diff --git a/tests/contract/v1/test_artifacts.py b/tests/contract/v1/test_artifacts.py index 58397e7..b2b8ecc 100644 --- a/tests/contract/v1/test_artifacts.py +++ b/tests/contract/v1/test_artifacts.py @@ -1,10 +1,10 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: 64d1f5f9dc06 +# Content hash: 98451127b0cf import pytest -from archastro.platform import PlatformClient +from archastro.platform import AsyncPlatformClient, PlatformClient from archastro.platform.runtime.http_client import ApiError PRISM_URL = "http://127.0.0.1:4040" @@ -26,158 +26,492 @@ def _error_client(code: int) -> PlatformClient: ) -async def test_artifacts_delete_success(): +def _async_client() -> AsyncPlatformClient: + return AsyncPlatformClient( + base_url=PRISM_URL, + default_headers={"x-archastro-api-key": "pk_test-key"}, + access_token="test-token", + ) + + +def _async_error_client(code: int) -> AsyncPlatformClient: + return AsyncPlatformClient( + base_url=PRISM_URL, + default_headers={"x-archastro-api-key": "pk_test-key", "Prefer": f"code={code}"}, + access_token="test-token", + ) + + +def test_artifacts_delete_success(): client = _client() - result = await client.v1.artifacts.delete("test-value") - assert result is None + try: + result = client.v1.artifacts.delete("test-value") + assert result is None + finally: + client.close() -async def test_artifacts_delete_error_401(): +def test_artifacts_delete_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.artifacts.delete("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.artifacts.delete("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_artifacts_delete_error_403(): +def test_artifacts_delete_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.artifacts.delete("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.artifacts.delete("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_artifacts_delete_error_404(): +def test_artifacts_delete_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.artifacts.delete("test-value") - assert exc_info.value.status == 404 - - -async def test_artifacts_get_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.artifacts.delete("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_artifacts_delete_success(): + client = _async_client() + try: + result = await client.v1.artifacts.delete("test-value") + assert result is None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_artifacts_delete_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.artifacts.delete("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_artifacts_delete_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.artifacts.delete("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_artifacts_delete_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.artifacts.delete("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +def test_artifacts_get_success(): client = _client() - result = await client.v1.artifacts.get("test-value") - assert result is not None + try: + result = client.v1.artifacts.get("test-value") + assert result is not None + finally: + client.close() -async def test_artifacts_get_error_401(): +def test_artifacts_get_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.artifacts.get("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.artifacts.get("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_artifacts_get_error_403(): +def test_artifacts_get_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.artifacts.get("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.artifacts.get("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_artifacts_get_error_404(): +def test_artifacts_get_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.artifacts.get("test-value") - assert exc_info.value.status == 404 - - -async def test_artifacts_replace_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.artifacts.get("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_artifacts_get_success(): + client = _async_client() + try: + result = await client.v1.artifacts.get("test-value") + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_artifacts_get_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.artifacts.get("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_artifacts_get_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.artifacts.get("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_artifacts_get_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.artifacts.get("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +def test_artifacts_replace_success(): client = _client() - result = await client.v1.artifacts.replace("test-value", {"from_version": 1}) - assert result is not None + try: + result = client.v1.artifacts.replace("test-value", {"from_version": 1}) + assert result is not None + finally: + client.close() -async def test_artifacts_replace_error_401(): +def test_artifacts_replace_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.artifacts.replace("test-value", {"from_version": 1}) - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.artifacts.replace("test-value", {"from_version": 1}) + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_artifacts_replace_error_403(): +def test_artifacts_replace_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.artifacts.replace("test-value", {"from_version": 1}) - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.artifacts.replace("test-value", {"from_version": 1}) + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_artifacts_replace_error_404(): +def test_artifacts_replace_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.artifacts.replace("test-value", {"from_version": 1}) - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.artifacts.replace("test-value", {"from_version": 1}) + assert exc_info.value.status == 404 + finally: + ec.close() -async def test_artifacts_replace_error_409(): +def test_artifacts_replace_error_409(): ec = _error_client(409) - with pytest.raises(ApiError) as exc_info: - await ec.v1.artifacts.replace("test-value", {"from_version": 1}) - assert exc_info.value.status == 409 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.artifacts.replace("test-value", {"from_version": 1}) + assert exc_info.value.status == 409 + finally: + ec.close() -async def test_artifacts_replace_error_422(): +def test_artifacts_replace_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.artifacts.replace("test-value", {"from_version": 1}) - assert exc_info.value.status == 422 - - -async def test_artifacts_archive_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.artifacts.replace("test-value", {"from_version": 1}) + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_artifacts_replace_success(): + client = _async_client() + try: + result = await client.v1.artifacts.replace("test-value", {"from_version": 1}) + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_artifacts_replace_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.artifacts.replace("test-value", {"from_version": 1}) + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_artifacts_replace_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.artifacts.replace("test-value", {"from_version": 1}) + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_artifacts_replace_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.artifacts.replace("test-value", {"from_version": 1}) + assert exc_info.value.status == 404 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_artifacts_replace_error_409(): + ec = _async_error_client(409) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.artifacts.replace("test-value", {"from_version": 1}) + assert exc_info.value.status == 409 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_artifacts_replace_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.artifacts.replace("test-value", {"from_version": 1}) + assert exc_info.value.status == 422 + finally: + await ec.close() + + +def test_artifacts_archive_success(): client = _client() - result = await client.v1.artifacts.archive("test-value") - assert result is None + try: + result = client.v1.artifacts.archive("test-value") + assert result is None + finally: + client.close() -async def test_artifacts_archive_error_401(): +def test_artifacts_archive_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.artifacts.archive("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.artifacts.archive("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_artifacts_archive_error_403(): +def test_artifacts_archive_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.artifacts.archive("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.artifacts.archive("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_artifacts_archive_error_404(): +def test_artifacts_archive_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.artifacts.archive("test-value") - assert exc_info.value.status == 404 - - -async def test_artifacts_content_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.artifacts.archive("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_artifacts_archive_success(): + client = _async_client() + try: + result = await client.v1.artifacts.archive("test-value") + assert result is None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_artifacts_archive_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.artifacts.archive("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_artifacts_archive_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.artifacts.archive("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_artifacts_archive_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.artifacts.archive("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +def test_artifacts_content_success(): client = _client() - result = await client.v1.artifacts.content("test-value") - assert result["content"] is not None - assert result["mime_type"] + try: + result = client.v1.artifacts.content("test-value") + assert result["content"] is not None + assert result["mime_type"] + finally: + client.close() -async def test_artifacts_content_error_401(): +def test_artifacts_content_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.artifacts.content("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.artifacts.content("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_artifacts_content_error_403(): +def test_artifacts_content_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.artifacts.content("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.artifacts.content("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_artifacts_content_error_404(): +def test_artifacts_content_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.artifacts.content("test-value") - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.artifacts.content("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() -async def test_artifacts_content_error_422(): +def test_artifacts_content_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.artifacts.content("test-value") - assert exc_info.value.status == 422 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.artifacts.content("test-value") + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_artifacts_content_success(): + client = _async_client() + try: + result = await client.v1.artifacts.content("test-value") + assert result["content"] is not None + assert result["mime_type"] + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_artifacts_content_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.artifacts.content("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_artifacts_content_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.artifacts.content("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_artifacts_content_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.artifacts.content("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_artifacts_content_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.artifacts.content("test-value") + assert exc_info.value.status == 422 + finally: + await ec.close() diff --git a/tests/contract/v1/test_automation_runs.py b/tests/contract/v1/test_automation_runs.py index a5a43c3..0f0edf3 100644 --- a/tests/contract/v1/test_automation_runs.py +++ b/tests/contract/v1/test_automation_runs.py @@ -1,10 +1,10 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: aee4c433c044 +# Content hash: d0e91f045ecb import pytest -from archastro.platform import PlatformClient +from archastro.platform import AsyncPlatformClient, PlatformClient from archastro.platform.runtime.http_client import ApiError PRISM_URL = "http://127.0.0.1:4040" @@ -26,28 +26,99 @@ def _error_client(code: int) -> PlatformClient: ) -async def test_automation_runs_get_success(): +def _async_client() -> AsyncPlatformClient: + return AsyncPlatformClient( + base_url=PRISM_URL, + default_headers={"x-archastro-api-key": "pk_test-key"}, + access_token="test-token", + ) + + +def _async_error_client(code: int) -> AsyncPlatformClient: + return AsyncPlatformClient( + base_url=PRISM_URL, + default_headers={"x-archastro-api-key": "pk_test-key", "Prefer": f"code={code}"}, + access_token="test-token", + ) + + +def test_automation_runs_get_success(): client = _client() - result = await client.v1.automation_runs.get("test-value") - assert result is not None + try: + result = client.v1.automation_runs.get("test-value") + assert result is not None + finally: + client.close() -async def test_automation_runs_get_error_401(): +def test_automation_runs_get_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.automation_runs.get("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.automation_runs.get("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_automation_runs_get_error_403(): +def test_automation_runs_get_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.automation_runs.get("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.automation_runs.get("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_automation_runs_get_error_404(): +def test_automation_runs_get_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.automation_runs.get("test-value") - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.automation_runs.get("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_automation_runs_get_success(): + client = _async_client() + try: + result = await client.v1.automation_runs.get("test-value") + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_automation_runs_get_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.automation_runs.get("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_automation_runs_get_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.automation_runs.get("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_automation_runs_get_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.automation_runs.get("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() diff --git a/tests/contract/v1/test_automations.py b/tests/contract/v1/test_automations.py index 1db3769..04b1597 100644 --- a/tests/contract/v1/test_automations.py +++ b/tests/contract/v1/test_automations.py @@ -1,10 +1,10 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: baf44e1e1e5c +# Content hash: 9664f1a508e5 import pytest -from archastro.platform import PlatformClient +from archastro.platform import AsyncPlatformClient, PlatformClient from archastro.platform.runtime.http_client import ApiError PRISM_URL = "http://127.0.0.1:4040" @@ -26,35 +26,120 @@ def _error_client(code: int) -> PlatformClient: ) -async def test_automations_invoke_success(): +def _async_client() -> AsyncPlatformClient: + return AsyncPlatformClient( + base_url=PRISM_URL, + default_headers={"x-archastro-api-key": "pk_test-key"}, + access_token="test-token", + ) + + +def _async_error_client(code: int) -> AsyncPlatformClient: + return AsyncPlatformClient( + base_url=PRISM_URL, + default_headers={"x-archastro-api-key": "pk_test-key", "Prefer": f"code={code}"}, + access_token="test-token", + ) + + +def test_automations_invoke_success(): client = _client() - result = await client.v1.automations.invoke("test-value", {}) - assert result is not None + try: + result = client.v1.automations.invoke("test-value", {}) + assert result is not None + finally: + client.close() -async def test_automations_invoke_error_401(): +def test_automations_invoke_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.automations.invoke("test-value", {}) - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.automations.invoke("test-value", {}) + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_automations_invoke_error_403(): +def test_automations_invoke_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.automations.invoke("test-value", {}) - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.automations.invoke("test-value", {}) + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_automations_invoke_error_404(): +def test_automations_invoke_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.automations.invoke("test-value", {}) - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.automations.invoke("test-value", {}) + assert exc_info.value.status == 404 + finally: + ec.close() -async def test_automations_invoke_error_422(): +def test_automations_invoke_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.automations.invoke("test-value", {}) - assert exc_info.value.status == 422 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.automations.invoke("test-value", {}) + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_automations_invoke_success(): + client = _async_client() + try: + result = await client.v1.automations.invoke("test-value", {}) + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_automations_invoke_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.automations.invoke("test-value", {}) + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_automations_invoke_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.automations.invoke("test-value", {}) + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_automations_invoke_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.automations.invoke("test-value", {}) + assert exc_info.value.status == 404 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_automations_invoke_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.automations.invoke("test-value", {}) + assert exc_info.value.status == 422 + finally: + await ec.close() diff --git a/tests/contract/v1/test_bug_reports.py b/tests/contract/v1/test_bug_reports.py index fba8ef6..0f736c5 100644 --- a/tests/contract/v1/test_bug_reports.py +++ b/tests/contract/v1/test_bug_reports.py @@ -1,10 +1,10 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: 20673fe30ea9 +# Content hash: 175ed1000ff5 import pytest -from archastro.platform import PlatformClient +from archastro.platform import AsyncPlatformClient, PlatformClient from archastro.platform.runtime.http_client import ApiError PRISM_URL = "http://127.0.0.1:4040" @@ -26,61 +26,180 @@ def _error_client(code: int) -> PlatformClient: ) -async def test_bug_reports_create_success(): - client = _client() - result = await client.v1.bug_reports.create( - {"client": "test-value", "client_version": "test-value", "description": "test description"} +def _async_client() -> AsyncPlatformClient: + return AsyncPlatformClient( + base_url=PRISM_URL, + default_headers={"x-archastro-api-key": "pk_test-key"}, + access_token="test-token", ) - assert result is not None -async def test_bug_reports_create_error_400(): - ec = _error_client(400) - with pytest.raises(ApiError) as exc_info: - await ec.v1.bug_reports.create( - { - "client": "test-value", - "client_version": "test-value", - "description": "test description", - } - ) - assert exc_info.value.status == 400 +def _async_error_client(code: int) -> AsyncPlatformClient: + return AsyncPlatformClient( + base_url=PRISM_URL, + default_headers={"x-archastro-api-key": "pk_test-key", "Prefer": f"code={code}"}, + access_token="test-token", + ) -async def test_bug_reports_create_error_401(): - ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.bug_reports.create( +def test_bug_reports_create_success(): + client = _client() + try: + result = client.v1.bug_reports.create( { "client": "test-value", "client_version": "test-value", "description": "test description", } ) - assert exc_info.value.status == 401 + assert result is not None + finally: + client.close() -async def test_bug_reports_create_error_422(): +def test_bug_reports_create_error_400(): + ec = _error_client(400) + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.bug_reports.create( + { + "client": "test-value", + "client_version": "test-value", + "description": "test description", + } + ) + assert exc_info.value.status == 400 + finally: + ec.close() + + +def test_bug_reports_create_error_401(): + ec = _error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.bug_reports.create( + { + "client": "test-value", + "client_version": "test-value", + "description": "test description", + } + ) + assert exc_info.value.status == 401 + finally: + ec.close() + + +def test_bug_reports_create_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.bug_reports.create( - { - "client": "test-value", - "client_version": "test-value", - "description": "test description", - } - ) - assert exc_info.value.status == 422 - - -async def test_bug_reports_create_error_429(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.bug_reports.create( + { + "client": "test-value", + "client_version": "test-value", + "description": "test description", + } + ) + assert exc_info.value.status == 422 + finally: + ec.close() + + +def test_bug_reports_create_error_429(): ec = _error_client(429) - with pytest.raises(ApiError) as exc_info: - await ec.v1.bug_reports.create( + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.bug_reports.create( + { + "client": "test-value", + "client_version": "test-value", + "description": "test description", + } + ) + assert exc_info.value.status == 429 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_bug_reports_create_success(): + client = _async_client() + try: + result = await client.v1.bug_reports.create( { "client": "test-value", "client_version": "test-value", "description": "test description", } ) - assert exc_info.value.status == 429 + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_bug_reports_create_error_400(): + ec = _async_error_client(400) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.bug_reports.create( + { + "client": "test-value", + "client_version": "test-value", + "description": "test description", + } + ) + assert exc_info.value.status == 400 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_bug_reports_create_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.bug_reports.create( + { + "client": "test-value", + "client_version": "test-value", + "description": "test description", + } + ) + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_bug_reports_create_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.bug_reports.create( + { + "client": "test-value", + "client_version": "test-value", + "description": "test description", + } + ) + assert exc_info.value.status == 422 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_bug_reports_create_error_429(): + ec = _async_error_client(429) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.bug_reports.create( + { + "client": "test-value", + "client_version": "test-value", + "description": "test description", + } + ) + assert exc_info.value.status == 429 + finally: + await ec.close() diff --git a/tests/contract/v1/test_config.py b/tests/contract/v1/test_config.py index 62782c8..6f9ed12 100644 --- a/tests/contract/v1/test_config.py +++ b/tests/contract/v1/test_config.py @@ -1,10 +1,10 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: 1d6899303acb +# Content hash: 12f52938693a import pytest -from archastro.platform import PlatformClient +from archastro.platform import AsyncPlatformClient, PlatformClient from archastro.platform.runtime.http_client import ApiError PRISM_URL = "http://127.0.0.1:4040" @@ -26,602 +26,1814 @@ def _error_client(code: int) -> PlatformClient: ) -async def test_config_list_success(): - client = _client() - result = await client.v1.config.list() - assert result is not None - assert "data" in result - assert isinstance(result["data"], list) +def _async_client() -> AsyncPlatformClient: + return AsyncPlatformClient( + base_url=PRISM_URL, + default_headers={"x-archastro-api-key": "pk_test-key"}, + access_token="test-token", + ) -async def test_config_list_error_400(): - ec = _error_client(400) - with pytest.raises(ApiError) as exc_info: - await ec.v1.config.list() - assert exc_info.value.status == 400 +def _async_error_client(code: int) -> AsyncPlatformClient: + return AsyncPlatformClient( + base_url=PRISM_URL, + default_headers={"x-archastro-api-key": "pk_test-key", "Prefer": f"code={code}"}, + access_token="test-token", + ) -async def test_config_list_error_401(): - ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.config.list() - assert exc_info.value.status == 401 +def test_config_list_success(): + client = _client() + try: + result = client.v1.config.list() + assert result is not None + assert "data" in result + assert isinstance(result["data"], list) + finally: + client.close() -async def test_config_create_success(): - client = _client() - result = await client.v1.config.create( - {"kind": "test", "mime_type": "application/json", "raw_content": "test content"} - ) - assert result is not None +def test_config_list_error_400(): + ec = _error_client(400) + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.config.list() + assert exc_info.value.status == 400 + finally: + ec.close() -async def test_config_create_error_401(): +def test_config_list_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.config.create( + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.config.list() + assert exc_info.value.status == 401 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_config_list_success(): + client = _async_client() + try: + result = await client.v1.config.list() + assert result is not None + assert "data" in result + assert isinstance(result["data"], list) + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_config_list_error_400(): + ec = _async_error_client(400) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.config.list() + assert exc_info.value.status == 400 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_config_list_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.config.list() + assert exc_info.value.status == 401 + finally: + await ec.close() + + +def test_config_create_success(): + client = _client() + try: + result = client.v1.config.create( {"kind": "test", "mime_type": "application/json", "raw_content": "test content"} ) - assert exc_info.value.status == 401 + assert result is not None + finally: + client.close() -async def test_config_create_error_403(): +def test_config_create_error_401(): + ec = _error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.config.create( + {"kind": "test", "mime_type": "application/json", "raw_content": "test content"} + ) + assert exc_info.value.status == 401 + finally: + ec.close() + + +def test_config_create_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.config.create( - {"kind": "test", "mime_type": "application/json", "raw_content": "test content"} - ) - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.config.create( + {"kind": "test", "mime_type": "application/json", "raw_content": "test content"} + ) + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_config_create_error_409(): +def test_config_create_error_409(): ec = _error_client(409) - with pytest.raises(ApiError) as exc_info: - await ec.v1.config.create( - {"kind": "test", "mime_type": "application/json", "raw_content": "test content"} - ) - assert exc_info.value.status == 409 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.config.create( + {"kind": "test", "mime_type": "application/json", "raw_content": "test content"} + ) + assert exc_info.value.status == 409 + finally: + ec.close() -async def test_config_create_error_422(): +def test_config_create_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.config.create( + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.config.create( + {"kind": "test", "mime_type": "application/json", "raw_content": "test content"} + ) + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_config_create_success(): + client = _async_client() + try: + result = await client.v1.config.create( {"kind": "test", "mime_type": "application/json", "raw_content": "test content"} ) - assert exc_info.value.status == 422 - - -async def test_config_encrypt_secret_success(): + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_config_create_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.config.create( + {"kind": "test", "mime_type": "application/json", "raw_content": "test content"} + ) + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_config_create_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.config.create( + {"kind": "test", "mime_type": "application/json", "raw_content": "test content"} + ) + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_config_create_error_409(): + ec = _async_error_client(409) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.config.create( + {"kind": "test", "mime_type": "application/json", "raw_content": "test content"} + ) + assert exc_info.value.status == 409 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_config_create_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.config.create( + {"kind": "test", "mime_type": "application/json", "raw_content": "test content"} + ) + assert exc_info.value.status == 422 + finally: + await ec.close() + + +def test_config_encrypt_secret_success(): client = _client() - result = await client.v1.config.encrypt_secret({"plaintext": "test-value"}) - assert result is not None + try: + result = client.v1.config.encrypt_secret({"plaintext": "test-value"}) + assert result is not None + finally: + client.close() -async def test_config_encrypt_secret_error_401(): +def test_config_encrypt_secret_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.config.encrypt_secret({"plaintext": "test-value"}) - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.config.encrypt_secret({"plaintext": "test-value"}) + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_config_encrypt_secret_error_403(): +def test_config_encrypt_secret_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.config.encrypt_secret({"plaintext": "test-value"}) - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.config.encrypt_secret({"plaintext": "test-value"}) + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_config_encrypt_secret_error_422(): +def test_config_encrypt_secret_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.config.encrypt_secret({"plaintext": "test-value"}) - assert exc_info.value.status == 422 - - -async def test_config_facets_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.config.encrypt_secret({"plaintext": "test-value"}) + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_config_encrypt_secret_success(): + client = _async_client() + try: + result = await client.v1.config.encrypt_secret({"plaintext": "test-value"}) + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_config_encrypt_secret_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.config.encrypt_secret({"plaintext": "test-value"}) + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_config_encrypt_secret_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.config.encrypt_secret({"plaintext": "test-value"}) + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_config_encrypt_secret_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.config.encrypt_secret({"plaintext": "test-value"}) + assert exc_info.value.status == 422 + finally: + await ec.close() + + +def test_config_facets_success(): client = _client() - result = await client.v1.config.facets() - assert result is not None + try: + result = client.v1.config.facets() + assert result is not None + finally: + client.close() -async def test_config_facets_error_401(): +def test_config_facets_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.config.facets() - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.config.facets() + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_config_facets_error_403(): +def test_config_facets_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.config.facets() - assert exc_info.value.status == 403 - - -async def test_config_validate_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.config.facets() + assert exc_info.value.status == 403 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_config_facets_success(): + client = _async_client() + try: + result = await client.v1.config.facets() + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_config_facets_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.config.facets() + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_config_facets_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.config.facets() + assert exc_info.value.status == 403 + finally: + await ec.close() + + +def test_config_validate_success(): client = _client() - result = await client.v1.config.validate( - {"kind": "test", "mime_type": "application/json", "raw_content": "test content"} - ) - assert result is not None + try: + result = client.v1.config.validate( + {"kind": "test", "mime_type": "application/json", "raw_content": "test content"} + ) + assert result is not None + finally: + client.close() -async def test_config_validate_error_400(): +def test_config_validate_error_400(): ec = _error_client(400) - with pytest.raises(ApiError) as exc_info: - await ec.v1.config.validate( - {"kind": "test", "mime_type": "application/json", "raw_content": "test content"} - ) - assert exc_info.value.status == 400 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.config.validate( + {"kind": "test", "mime_type": "application/json", "raw_content": "test content"} + ) + assert exc_info.value.status == 400 + finally: + ec.close() -async def test_config_validate_error_401(): +def test_config_validate_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.config.validate( - {"kind": "test", "mime_type": "application/json", "raw_content": "test content"} - ) - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.config.validate( + {"kind": "test", "mime_type": "application/json", "raw_content": "test content"} + ) + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_config_validate_error_403(): +def test_config_validate_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.config.validate( + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.config.validate( + {"kind": "test", "mime_type": "application/json", "raw_content": "test content"} + ) + assert exc_info.value.status == 403 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_config_validate_success(): + client = _async_client() + try: + result = await client.v1.config.validate( {"kind": "test", "mime_type": "application/json", "raw_content": "test content"} ) - assert exc_info.value.status == 403 - - -async def test_config_delete_success(): + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_config_validate_error_400(): + ec = _async_error_client(400) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.config.validate( + {"kind": "test", "mime_type": "application/json", "raw_content": "test content"} + ) + assert exc_info.value.status == 400 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_config_validate_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.config.validate( + {"kind": "test", "mime_type": "application/json", "raw_content": "test content"} + ) + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_config_validate_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.config.validate( + {"kind": "test", "mime_type": "application/json", "raw_content": "test content"} + ) + assert exc_info.value.status == 403 + finally: + await ec.close() + + +def test_config_delete_success(): client = _client() - result = await client.v1.config.delete("test-value") - assert result is None + try: + result = client.v1.config.delete("test-value") + assert result is None + finally: + client.close() -async def test_config_delete_error_400(): +def test_config_delete_error_400(): ec = _error_client(400) - with pytest.raises(ApiError) as exc_info: - await ec.v1.config.delete("test-value") - assert exc_info.value.status == 400 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.config.delete("test-value") + assert exc_info.value.status == 400 + finally: + ec.close() -async def test_config_delete_error_401(): +def test_config_delete_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.config.delete("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.config.delete("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_config_delete_error_403(): +def test_config_delete_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.config.delete("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.config.delete("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_config_delete_error_404(): +def test_config_delete_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.config.delete("test-value") - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.config.delete("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() -async def test_config_delete_error_422(): +def test_config_delete_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.config.delete("test-value") - assert exc_info.value.status == 422 - - -async def test_config_get_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.config.delete("test-value") + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_config_delete_success(): + client = _async_client() + try: + result = await client.v1.config.delete("test-value") + assert result is None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_config_delete_error_400(): + ec = _async_error_client(400) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.config.delete("test-value") + assert exc_info.value.status == 400 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_config_delete_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.config.delete("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_config_delete_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.config.delete("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_config_delete_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.config.delete("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_config_delete_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.config.delete("test-value") + assert exc_info.value.status == 422 + finally: + await ec.close() + + +def test_config_get_success(): client = _client() - result = await client.v1.config.get("test-value") - assert result is not None + try: + result = client.v1.config.get("test-value") + assert result is not None + finally: + client.close() -async def test_config_get_error_400(): +def test_config_get_error_400(): ec = _error_client(400) - with pytest.raises(ApiError) as exc_info: - await ec.v1.config.get("test-value") - assert exc_info.value.status == 400 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.config.get("test-value") + assert exc_info.value.status == 400 + finally: + ec.close() -async def test_config_get_error_401(): +def test_config_get_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.config.get("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.config.get("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_config_get_error_403(): +def test_config_get_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.config.get("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.config.get("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_config_get_error_404(): +def test_config_get_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.config.get("test-value") - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.config.get("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() -async def test_config_get_error_422(): +def test_config_get_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.config.get("test-value") - assert exc_info.value.status == 422 - - -async def test_config_update_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.config.get("test-value") + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_config_get_success(): + client = _async_client() + try: + result = await client.v1.config.get("test-value") + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_config_get_error_400(): + ec = _async_error_client(400) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.config.get("test-value") + assert exc_info.value.status == 400 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_config_get_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.config.get("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_config_get_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.config.get("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_config_get_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.config.get("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_config_get_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.config.get("test-value") + assert exc_info.value.status == 422 + finally: + await ec.close() + + +def test_config_update_success(): client = _client() - result = await client.v1.config.update("test-value", {}) - assert result is not None + try: + result = client.v1.config.update("test-value", {}) + assert result is not None + finally: + client.close() -async def test_config_update_error_400(): +def test_config_update_error_400(): ec = _error_client(400) - with pytest.raises(ApiError) as exc_info: - await ec.v1.config.update("test-value", {}) - assert exc_info.value.status == 400 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.config.update("test-value", {}) + assert exc_info.value.status == 400 + finally: + ec.close() -async def test_config_update_error_401(): +def test_config_update_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.config.update("test-value", {}) - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.config.update("test-value", {}) + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_config_update_error_403(): +def test_config_update_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.config.update("test-value", {}) - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.config.update("test-value", {}) + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_config_update_error_404(): +def test_config_update_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.config.update("test-value", {}) - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.config.update("test-value", {}) + assert exc_info.value.status == 404 + finally: + ec.close() -async def test_config_update_error_409(): +def test_config_update_error_409(): ec = _error_client(409) - with pytest.raises(ApiError) as exc_info: - await ec.v1.config.update("test-value", {}) - assert exc_info.value.status == 409 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.config.update("test-value", {}) + assert exc_info.value.status == 409 + finally: + ec.close() -async def test_config_update_error_422(): +def test_config_update_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.config.update("test-value", {}) - assert exc_info.value.status == 422 - - -async def test_config_archive_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.config.update("test-value", {}) + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_config_update_success(): + client = _async_client() + try: + result = await client.v1.config.update("test-value", {}) + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_config_update_error_400(): + ec = _async_error_client(400) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.config.update("test-value", {}) + assert exc_info.value.status == 400 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_config_update_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.config.update("test-value", {}) + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_config_update_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.config.update("test-value", {}) + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_config_update_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.config.update("test-value", {}) + assert exc_info.value.status == 404 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_config_update_error_409(): + ec = _async_error_client(409) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.config.update("test-value", {}) + assert exc_info.value.status == 409 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_config_update_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.config.update("test-value", {}) + assert exc_info.value.status == 422 + finally: + await ec.close() + + +def test_config_archive_success(): client = _client() - result = await client.v1.config.archive("test-value", {}) - assert result is not None + try: + result = client.v1.config.archive("test-value", {}) + assert result is not None + finally: + client.close() -async def test_config_archive_error_400(): +def test_config_archive_error_400(): ec = _error_client(400) - with pytest.raises(ApiError) as exc_info: - await ec.v1.config.archive("test-value", {}) - assert exc_info.value.status == 400 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.config.archive("test-value", {}) + assert exc_info.value.status == 400 + finally: + ec.close() -async def test_config_archive_error_401(): +def test_config_archive_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.config.archive("test-value", {}) - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.config.archive("test-value", {}) + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_config_archive_error_403(): +def test_config_archive_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.config.archive("test-value", {}) - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.config.archive("test-value", {}) + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_config_archive_error_404(): +def test_config_archive_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.config.archive("test-value", {}) - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.config.archive("test-value", {}) + assert exc_info.value.status == 404 + finally: + ec.close() -async def test_config_archive_error_422(): +def test_config_archive_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.config.archive("test-value", {}) - assert exc_info.value.status == 422 - - -async def test_config_change_owner_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.config.archive("test-value", {}) + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_config_archive_success(): + client = _async_client() + try: + result = await client.v1.config.archive("test-value", {}) + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_config_archive_error_400(): + ec = _async_error_client(400) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.config.archive("test-value", {}) + assert exc_info.value.status == 400 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_config_archive_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.config.archive("test-value", {}) + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_config_archive_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.config.archive("test-value", {}) + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_config_archive_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.config.archive("test-value", {}) + assert exc_info.value.status == 404 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_config_archive_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.config.archive("test-value", {}) + assert exc_info.value.status == 422 + finally: + await ec.close() + + +def test_config_change_owner_success(): client = _client() - result = await client.v1.config.change_owner("test-value", {}) - assert result is not None + try: + result = client.v1.config.change_owner("test-value", {}) + assert result is not None + finally: + client.close() -async def test_config_change_owner_error_400(): +def test_config_change_owner_error_400(): ec = _error_client(400) - with pytest.raises(ApiError) as exc_info: - await ec.v1.config.change_owner("test-value", {}) - assert exc_info.value.status == 400 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.config.change_owner("test-value", {}) + assert exc_info.value.status == 400 + finally: + ec.close() -async def test_config_change_owner_error_401(): +def test_config_change_owner_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.config.change_owner("test-value", {}) - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.config.change_owner("test-value", {}) + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_config_change_owner_error_403(): +def test_config_change_owner_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.config.change_owner("test-value", {}) - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.config.change_owner("test-value", {}) + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_config_change_owner_error_404(): +def test_config_change_owner_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.config.change_owner("test-value", {}) - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.config.change_owner("test-value", {}) + assert exc_info.value.status == 404 + finally: + ec.close() -async def test_config_change_owner_error_422(): +def test_config_change_owner_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.config.change_owner("test-value", {}) - assert exc_info.value.status == 422 - - -async def test_config_content_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.config.change_owner("test-value", {}) + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_config_change_owner_success(): + client = _async_client() + try: + result = await client.v1.config.change_owner("test-value", {}) + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_config_change_owner_error_400(): + ec = _async_error_client(400) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.config.change_owner("test-value", {}) + assert exc_info.value.status == 400 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_config_change_owner_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.config.change_owner("test-value", {}) + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_config_change_owner_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.config.change_owner("test-value", {}) + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_config_change_owner_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.config.change_owner("test-value", {}) + assert exc_info.value.status == 404 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_config_change_owner_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.config.change_owner("test-value", {}) + assert exc_info.value.status == 422 + finally: + await ec.close() + + +def test_config_content_success(): client = _client() - result = await client.v1.config.content("test-value") - assert result["content"] is not None - assert result["mime_type"] + try: + result = client.v1.config.content("test-value") + assert result["content"] is not None + assert result["mime_type"] + finally: + client.close() -async def test_config_content_error_400(): +def test_config_content_error_400(): ec = _error_client(400) - with pytest.raises(ApiError) as exc_info: - await ec.v1.config.content("test-value") - assert exc_info.value.status == 400 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.config.content("test-value") + assert exc_info.value.status == 400 + finally: + ec.close() -async def test_config_content_error_401(): +def test_config_content_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.config.content("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.config.content("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_config_content_error_403(): +def test_config_content_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.config.content("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.config.content("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_config_content_error_404(): +def test_config_content_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.config.content("test-value") - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.config.content("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() -async def test_config_content_error_422(): +def test_config_content_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.config.content("test-value") - assert exc_info.value.status == 422 - - -async def test_config_unarchive_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.config.content("test-value") + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_config_content_success(): + client = _async_client() + try: + result = await client.v1.config.content("test-value") + assert result["content"] is not None + assert result["mime_type"] + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_config_content_error_400(): + ec = _async_error_client(400) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.config.content("test-value") + assert exc_info.value.status == 400 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_config_content_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.config.content("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_config_content_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.config.content("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_config_content_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.config.content("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_config_content_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.config.content("test-value") + assert exc_info.value.status == 422 + finally: + await ec.close() + + +def test_config_unarchive_success(): client = _client() - result = await client.v1.config.unarchive("test-value", {}) - assert result is not None + try: + result = client.v1.config.unarchive("test-value", {}) + assert result is not None + finally: + client.close() -async def test_config_unarchive_error_400(): +def test_config_unarchive_error_400(): ec = _error_client(400) - with pytest.raises(ApiError) as exc_info: - await ec.v1.config.unarchive("test-value", {}) - assert exc_info.value.status == 400 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.config.unarchive("test-value", {}) + assert exc_info.value.status == 400 + finally: + ec.close() -async def test_config_unarchive_error_401(): +def test_config_unarchive_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.config.unarchive("test-value", {}) - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.config.unarchive("test-value", {}) + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_config_unarchive_error_403(): +def test_config_unarchive_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.config.unarchive("test-value", {}) - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.config.unarchive("test-value", {}) + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_config_unarchive_error_404(): +def test_config_unarchive_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.config.unarchive("test-value", {}) - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.config.unarchive("test-value", {}) + assert exc_info.value.status == 404 + finally: + ec.close() -async def test_config_unarchive_error_422(): +def test_config_unarchive_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.config.unarchive("test-value", {}) - assert exc_info.value.status == 422 - - -async def test_config_versions_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.config.unarchive("test-value", {}) + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_config_unarchive_success(): + client = _async_client() + try: + result = await client.v1.config.unarchive("test-value", {}) + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_config_unarchive_error_400(): + ec = _async_error_client(400) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.config.unarchive("test-value", {}) + assert exc_info.value.status == 400 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_config_unarchive_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.config.unarchive("test-value", {}) + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_config_unarchive_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.config.unarchive("test-value", {}) + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_config_unarchive_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.config.unarchive("test-value", {}) + assert exc_info.value.status == 404 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_config_unarchive_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.config.unarchive("test-value", {}) + assert exc_info.value.status == 422 + finally: + await ec.close() + + +def test_config_versions_success(): client = _client() - result = await client.v1.config.versions("test-value") - assert result is not None + try: + result = client.v1.config.versions("test-value") + assert result is not None + finally: + client.close() -async def test_config_versions_error_400(): +def test_config_versions_error_400(): ec = _error_client(400) - with pytest.raises(ApiError) as exc_info: - await ec.v1.config.versions("test-value") - assert exc_info.value.status == 400 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.config.versions("test-value") + assert exc_info.value.status == 400 + finally: + ec.close() -async def test_config_versions_error_401(): +def test_config_versions_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.config.versions("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.config.versions("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_config_versions_error_403(): +def test_config_versions_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.config.versions("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.config.versions("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_config_versions_error_404(): +def test_config_versions_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.config.versions("test-value") - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.config.versions("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() -async def test_config_versions_error_422(): +def test_config_versions_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.config.versions("test-value") - assert exc_info.value.status == 422 - - -async def test_config_kinds_list_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.config.versions("test-value") + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_config_versions_success(): + client = _async_client() + try: + result = await client.v1.config.versions("test-value") + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_config_versions_error_400(): + ec = _async_error_client(400) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.config.versions("test-value") + assert exc_info.value.status == 400 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_config_versions_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.config.versions("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_config_versions_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.config.versions("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_config_versions_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.config.versions("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_config_versions_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.config.versions("test-value") + assert exc_info.value.status == 422 + finally: + await ec.close() + + +def test_config_kinds_list_success(): client = _client() - result = await client.v1.config.kinds.list() - assert result is not None - assert "data" in result - assert isinstance(result["data"], list) + try: + result = client.v1.config.kinds.list() + assert result is not None + assert "data" in result + assert isinstance(result["data"], list) + finally: + client.close() -async def test_config_kinds_list_error_401(): +def test_config_kinds_list_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.config.kinds.list() - assert exc_info.value.status == 401 - - -async def test_config_kinds_schema_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.config.kinds.list() + assert exc_info.value.status == 401 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_config_kinds_list_success(): + client = _async_client() + try: + result = await client.v1.config.kinds.list() + assert result is not None + assert "data" in result + assert isinstance(result["data"], list) + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_config_kinds_list_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.config.kinds.list() + assert exc_info.value.status == 401 + finally: + await ec.close() + + +def test_config_kinds_schema_success(): client = _client() - result = await client.v1.config.kinds.schema("test") - assert result is not None + try: + result = client.v1.config.kinds.schema("test") + assert result is not None + finally: + client.close() -async def test_config_kinds_schema_error_401(): +def test_config_kinds_schema_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.config.kinds.schema("test") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.config.kinds.schema("test") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_config_kinds_schema_error_404(): +def test_config_kinds_schema_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.config.kinds.schema("test") - assert exc_info.value.status == 404 - - -async def test_config_system_list_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.config.kinds.schema("test") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_config_kinds_schema_success(): + client = _async_client() + try: + result = await client.v1.config.kinds.schema("test") + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_config_kinds_schema_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.config.kinds.schema("test") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_config_kinds_schema_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.config.kinds.schema("test") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +def test_config_system_list_success(): client = _client() - result = await client.v1.config.system.list() - assert result is not None - assert "data" in result - assert isinstance(result["data"], list) + try: + result = client.v1.config.system.list() + assert result is not None + assert "data" in result + assert isinstance(result["data"], list) + finally: + client.close() -async def test_config_system_list_error_401(): +def test_config_system_list_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.config.system.list() - assert exc_info.value.status == 401 - - -async def test_config_system_facets_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.config.system.list() + assert exc_info.value.status == 401 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_config_system_list_success(): + client = _async_client() + try: + result = await client.v1.config.system.list() + assert result is not None + assert "data" in result + assert isinstance(result["data"], list) + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_config_system_list_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.config.system.list() + assert exc_info.value.status == 401 + finally: + await ec.close() + + +def test_config_system_facets_success(): client = _client() - result = await client.v1.config.system.facets() - assert result is not None + try: + result = client.v1.config.system.facets() + assert result is not None + finally: + client.close() -async def test_config_system_facets_error_401(): +def test_config_system_facets_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.config.system.facets() - assert exc_info.value.status == 401 - - -async def test_config_system_get_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.config.system.facets() + assert exc_info.value.status == 401 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_config_system_facets_success(): + client = _async_client() + try: + result = await client.v1.config.system.facets() + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_config_system_facets_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.config.system.facets() + assert exc_info.value.status == 401 + finally: + await ec.close() + + +def test_config_system_get_success(): client = _client() - result = await client.v1.config.system.get("test-value") - assert result is not None + try: + result = client.v1.config.system.get("test-value") + assert result is not None + finally: + client.close() -async def test_config_system_get_error_401(): +def test_config_system_get_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.config.system.get("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.config.system.get("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_config_system_get_error_404(): +def test_config_system_get_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.config.system.get("test-value") - assert exc_info.value.status == 404 - - -async def test_config_system_clone_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.config.system.get("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_config_system_get_success(): + client = _async_client() + try: + result = await client.v1.config.system.get("test-value") + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_config_system_get_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.config.system.get("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_config_system_get_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.config.system.get("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +def test_config_system_clone_success(): client = _client() - result = await client.v1.config.system.clone("test-value", {}) - assert result is not None + try: + result = client.v1.config.system.clone("test-value", {}) + assert result is not None + finally: + client.close() -async def test_config_system_clone_error_400(): +def test_config_system_clone_error_400(): ec = _error_client(400) - with pytest.raises(ApiError) as exc_info: - await ec.v1.config.system.clone("test-value", {}) - assert exc_info.value.status == 400 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.config.system.clone("test-value", {}) + assert exc_info.value.status == 400 + finally: + ec.close() -async def test_config_system_clone_error_401(): +def test_config_system_clone_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.config.system.clone("test-value", {}) - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.config.system.clone("test-value", {}) + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_config_system_clone_error_404(): +def test_config_system_clone_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.config.system.clone("test-value", {}) - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.config.system.clone("test-value", {}) + assert exc_info.value.status == 404 + finally: + ec.close() -async def test_config_system_clone_error_422(): +def test_config_system_clone_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.config.system.clone("test-value", {}) - assert exc_info.value.status == 422 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.config.system.clone("test-value", {}) + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_config_system_clone_success(): + client = _async_client() + try: + result = await client.v1.config.system.clone("test-value", {}) + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_config_system_clone_error_400(): + ec = _async_error_client(400) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.config.system.clone("test-value", {}) + assert exc_info.value.status == 400 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_config_system_clone_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.config.system.clone("test-value", {}) + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_config_system_clone_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.config.system.clone("test-value", {}) + assert exc_info.value.status == 404 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_config_system_clone_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.config.system.clone("test-value", {}) + assert exc_info.value.status == 422 + finally: + await ec.close() diff --git a/tests/contract/v1/test_custom_objects.py b/tests/contract/v1/test_custom_objects.py index 9ad0300..c19c180 100644 --- a/tests/contract/v1/test_custom_objects.py +++ b/tests/contract/v1/test_custom_objects.py @@ -1,10 +1,10 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: 3d9717416290 +# Content hash: 086859d75bd6 import pytest -from archastro.platform import PlatformClient +from archastro.platform import AsyncPlatformClient, PlatformClient from archastro.platform.runtime.http_client import ApiError PRISM_URL = "http://127.0.0.1:4040" @@ -26,122 +26,385 @@ def _error_client(code: int) -> PlatformClient: ) -async def test_custom_objects_list_success(): +def _async_client() -> AsyncPlatformClient: + return AsyncPlatformClient( + base_url=PRISM_URL, + default_headers={"x-archastro-api-key": "pk_test-key"}, + access_token="test-token", + ) + + +def _async_error_client(code: int) -> AsyncPlatformClient: + return AsyncPlatformClient( + base_url=PRISM_URL, + default_headers={"x-archastro-api-key": "pk_test-key", "Prefer": f"code={code}"}, + access_token="test-token", + ) + + +def test_custom_objects_list_success(): client = _client() - result = await client.v1.custom_objects.list(type="test") - assert result is not None + try: + result = client.v1.custom_objects.list(type="test") + assert result is not None + finally: + client.close() -async def test_custom_objects_list_error_400(): +def test_custom_objects_list_error_400(): ec = _error_client(400) - with pytest.raises(ApiError) as exc_info: - await ec.v1.custom_objects.list(type="test") - assert exc_info.value.status == 400 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.custom_objects.list(type="test") + assert exc_info.value.status == 400 + finally: + ec.close() -async def test_custom_objects_list_error_401(): +def test_custom_objects_list_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.custom_objects.list(type="test") - assert exc_info.value.status == 401 - - -async def test_custom_objects_create_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.custom_objects.list(type="test") + assert exc_info.value.status == 401 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_custom_objects_list_success(): + client = _async_client() + try: + result = await client.v1.custom_objects.list(type="test") + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_custom_objects_list_error_400(): + ec = _async_error_client(400) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.custom_objects.list(type="test") + assert exc_info.value.status == 400 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_custom_objects_list_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.custom_objects.list(type="test") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +def test_custom_objects_create_success(): client = _client() - result = await client.v1.custom_objects.create({"fields": {}, "type": "test"}) - assert result is not None + try: + result = client.v1.custom_objects.create({"fields": {}, "type": "test"}) + assert result is not None + finally: + client.close() -async def test_custom_objects_create_error_401(): +def test_custom_objects_create_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.custom_objects.create({"fields": {}, "type": "test"}) - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.custom_objects.create({"fields": {}, "type": "test"}) + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_custom_objects_create_error_403(): +def test_custom_objects_create_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.custom_objects.create({"fields": {}, "type": "test"}) - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.custom_objects.create({"fields": {}, "type": "test"}) + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_custom_objects_create_error_404(): +def test_custom_objects_create_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.custom_objects.create({"fields": {}, "type": "test"}) - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.custom_objects.create({"fields": {}, "type": "test"}) + assert exc_info.value.status == 404 + finally: + ec.close() -async def test_custom_objects_create_error_422(): +def test_custom_objects_create_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.custom_objects.create({"fields": {}, "type": "test"}) - assert exc_info.value.status == 422 - - -async def test_custom_objects_delete_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.custom_objects.create({"fields": {}, "type": "test"}) + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_custom_objects_create_success(): + client = _async_client() + try: + result = await client.v1.custom_objects.create({"fields": {}, "type": "test"}) + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_custom_objects_create_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.custom_objects.create({"fields": {}, "type": "test"}) + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_custom_objects_create_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.custom_objects.create({"fields": {}, "type": "test"}) + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_custom_objects_create_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.custom_objects.create({"fields": {}, "type": "test"}) + assert exc_info.value.status == 404 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_custom_objects_create_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.custom_objects.create({"fields": {}, "type": "test"}) + assert exc_info.value.status == 422 + finally: + await ec.close() + + +def test_custom_objects_delete_success(): client = _client() - result = await client.v1.custom_objects.delete("test-value") - assert result is not None + try: + result = client.v1.custom_objects.delete("test-value") + assert result is not None + finally: + client.close() -async def test_custom_objects_delete_error_401(): +def test_custom_objects_delete_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.custom_objects.delete("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.custom_objects.delete("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_custom_objects_delete_error_404(): +def test_custom_objects_delete_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.custom_objects.delete("test-value") - assert exc_info.value.status == 404 - - -async def test_custom_objects_get_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.custom_objects.delete("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_custom_objects_delete_success(): + client = _async_client() + try: + result = await client.v1.custom_objects.delete("test-value") + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_custom_objects_delete_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.custom_objects.delete("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_custom_objects_delete_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.custom_objects.delete("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +def test_custom_objects_get_success(): client = _client() - result = await client.v1.custom_objects.get("test-value") - assert result is not None + try: + result = client.v1.custom_objects.get("test-value") + assert result is not None + finally: + client.close() -async def test_custom_objects_get_error_401(): +def test_custom_objects_get_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.custom_objects.get("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.custom_objects.get("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_custom_objects_get_error_404(): +def test_custom_objects_get_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.custom_objects.get("test-value") - assert exc_info.value.status == 404 - - -async def test_custom_objects_replace_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.custom_objects.get("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_custom_objects_get_success(): + client = _async_client() + try: + result = await client.v1.custom_objects.get("test-value") + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_custom_objects_get_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.custom_objects.get("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_custom_objects_get_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.custom_objects.get("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +def test_custom_objects_replace_success(): client = _client() - result = await client.v1.custom_objects.replace("test-value", {"fields": {}}) - assert result is not None + try: + result = client.v1.custom_objects.replace("test-value", {"fields": {}}) + assert result is not None + finally: + client.close() -async def test_custom_objects_replace_error_401(): +def test_custom_objects_replace_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.custom_objects.replace("test-value", {"fields": {}}) - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.custom_objects.replace("test-value", {"fields": {}}) + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_custom_objects_replace_error_404(): +def test_custom_objects_replace_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.custom_objects.replace("test-value", {"fields": {}}) - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.custom_objects.replace("test-value", {"fields": {}}) + assert exc_info.value.status == 404 + finally: + ec.close() -async def test_custom_objects_replace_error_422(): +def test_custom_objects_replace_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.custom_objects.replace("test-value", {"fields": {}}) - assert exc_info.value.status == 422 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.custom_objects.replace("test-value", {"fields": {}}) + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_custom_objects_replace_success(): + client = _async_client() + try: + result = await client.v1.custom_objects.replace("test-value", {"fields": {}}) + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_custom_objects_replace_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.custom_objects.replace("test-value", {"fields": {}}) + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_custom_objects_replace_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.custom_objects.replace("test-value", {"fields": {}}) + assert exc_info.value.status == 404 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_custom_objects_replace_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.custom_objects.replace("test-value", {"fields": {}}) + assert exc_info.value.status == 422 + finally: + await ec.close() diff --git a/tests/contract/v1/test_files.py b/tests/contract/v1/test_files.py index 85c4cb1..ea114c7 100644 --- a/tests/contract/v1/test_files.py +++ b/tests/contract/v1/test_files.py @@ -1,10 +1,10 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: 1c99d068dfe2 +# Content hash: 115825f932e8 import pytest -from archastro.platform import PlatformClient +from archastro.platform import AsyncPlatformClient, PlatformClient from archastro.platform.runtime.http_client import ApiError PRISM_URL = "http://127.0.0.1:4040" @@ -26,15 +26,59 @@ def _error_client(code: int) -> PlatformClient: ) -async def test_files_avatar_success(): +def _async_client() -> AsyncPlatformClient: + return AsyncPlatformClient( + base_url=PRISM_URL, + default_headers={"x-archastro-api-key": "pk_test-key"}, + access_token="test-token", + ) + + +def _async_error_client(code: int) -> AsyncPlatformClient: + return AsyncPlatformClient( + base_url=PRISM_URL, + default_headers={"x-archastro-api-key": "pk_test-key", "Prefer": f"code={code}"}, + access_token="test-token", + ) + + +def test_files_avatar_success(): client = _client() - result = await client.v1.files.avatar("test-value", token="test-token") - assert result["content"] is not None - assert result["mime_type"] + try: + result = client.v1.files.avatar("test-value", token="test-token") + assert result["content"] is not None + assert result["mime_type"] + finally: + client.close() -async def test_files_avatar_error_404(): +def test_files_avatar_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.files.avatar("test-value", token="test-token") - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.files.avatar("test-value", token="test-token") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_files_avatar_success(): + client = _async_client() + try: + result = await client.v1.files.avatar("test-value", token="test-token") + assert result["content"] is not None + assert result["mime_type"] + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_files_avatar_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.files.avatar("test-value", token="test-token") + assert exc_info.value.status == 404 + finally: + await ec.close() diff --git a/tests/contract/v1/test_installation_sources.py b/tests/contract/v1/test_installation_sources.py index 606815b..faef410 100644 --- a/tests/contract/v1/test_installation_sources.py +++ b/tests/contract/v1/test_installation_sources.py @@ -1,10 +1,10 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: 3f92a95ee470 +# Content hash: 2f115b519c20 import pytest -from archastro.platform import PlatformClient +from archastro.platform import AsyncPlatformClient, PlatformClient from archastro.platform.runtime.http_client import ApiError PRISM_URL = "http://127.0.0.1:4040" @@ -26,28 +26,99 @@ def _error_client(code: int) -> PlatformClient: ) -async def test_installation_sources_delete_success(): +def _async_client() -> AsyncPlatformClient: + return AsyncPlatformClient( + base_url=PRISM_URL, + default_headers={"x-archastro-api-key": "pk_test-key"}, + access_token="test-token", + ) + + +def _async_error_client(code: int) -> AsyncPlatformClient: + return AsyncPlatformClient( + base_url=PRISM_URL, + default_headers={"x-archastro-api-key": "pk_test-key", "Prefer": f"code={code}"}, + access_token="test-token", + ) + + +def test_installation_sources_delete_success(): client = _client() - result = await client.v1.installation_sources.delete("test-value") - assert result is None + try: + result = client.v1.installation_sources.delete("test-value") + assert result is None + finally: + client.close() -async def test_installation_sources_delete_error_401(): +def test_installation_sources_delete_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.installation_sources.delete("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.installation_sources.delete("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_installation_sources_delete_error_403(): +def test_installation_sources_delete_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.installation_sources.delete("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.installation_sources.delete("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_installation_sources_delete_error_404(): +def test_installation_sources_delete_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.installation_sources.delete("test-value") - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.installation_sources.delete("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_installation_sources_delete_success(): + client = _async_client() + try: + result = await client.v1.installation_sources.delete("test-value") + assert result is None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_installation_sources_delete_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.installation_sources.delete("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_installation_sources_delete_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.installation_sources.delete("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_installation_sources_delete_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.installation_sources.delete("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() diff --git a/tests/contract/v1/test_invites.py b/tests/contract/v1/test_invites.py index 460ec82..a1f9f61 100644 --- a/tests/contract/v1/test_invites.py +++ b/tests/contract/v1/test_invites.py @@ -1,10 +1,10 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: 3193c5471ba1 +# Content hash: 20e09d9fc0ff import pytest -from archastro.platform import PlatformClient +from archastro.platform import AsyncPlatformClient, PlatformClient from archastro.platform.runtime.http_client import ApiError PRISM_URL = "http://127.0.0.1:4040" @@ -26,49 +26,162 @@ def _error_client(code: int) -> PlatformClient: ) -async def test_invites_accept_success(): +def _async_client() -> AsyncPlatformClient: + return AsyncPlatformClient( + base_url=PRISM_URL, + default_headers={"x-archastro-api-key": "pk_test-key"}, + access_token="test-token", + ) + + +def _async_error_client(code: int) -> AsyncPlatformClient: + return AsyncPlatformClient( + base_url=PRISM_URL, + default_headers={"x-archastro-api-key": "pk_test-key", "Prefer": f"code={code}"}, + access_token="test-token", + ) + + +def test_invites_accept_success(): client = _client() - result = await client.v1.invites.accept({"key": "test-key"}) - assert result is not None + try: + result = client.v1.invites.accept({"key": "test-key"}) + assert result is not None + finally: + client.close() -async def test_invites_accept_error_401(): +def test_invites_accept_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.invites.accept({"key": "test-key"}) - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.invites.accept({"key": "test-key"}) + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_invites_accept_error_403(): +def test_invites_accept_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.invites.accept({"key": "test-key"}) - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.invites.accept({"key": "test-key"}) + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_invites_accept_error_404(): +def test_invites_accept_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.invites.accept({"key": "test-key"}) - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.invites.accept({"key": "test-key"}) + assert exc_info.value.status == 404 + finally: + ec.close() -async def test_invites_accept_error_409(): +def test_invites_accept_error_409(): ec = _error_client(409) - with pytest.raises(ApiError) as exc_info: - await ec.v1.invites.accept({"key": "test-key"}) - assert exc_info.value.status == 409 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.invites.accept({"key": "test-key"}) + assert exc_info.value.status == 409 + finally: + ec.close() -async def test_invites_accept_error_422(): +def test_invites_accept_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.invites.accept({"key": "test-key"}) - assert exc_info.value.status == 422 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.invites.accept({"key": "test-key"}) + assert exc_info.value.status == 422 + finally: + ec.close() -async def test_invites_accept_error_429(): +def test_invites_accept_error_429(): ec = _error_client(429) - with pytest.raises(ApiError) as exc_info: - await ec.v1.invites.accept({"key": "test-key"}) - assert exc_info.value.status == 429 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.invites.accept({"key": "test-key"}) + assert exc_info.value.status == 429 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_invites_accept_success(): + client = _async_client() + try: + result = await client.v1.invites.accept({"key": "test-key"}) + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_invites_accept_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.invites.accept({"key": "test-key"}) + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_invites_accept_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.invites.accept({"key": "test-key"}) + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_invites_accept_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.invites.accept({"key": "test-key"}) + assert exc_info.value.status == 404 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_invites_accept_error_409(): + ec = _async_error_client(409) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.invites.accept({"key": "test-key"}) + assert exc_info.value.status == 409 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_invites_accept_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.invites.accept({"key": "test-key"}) + assert exc_info.value.status == 422 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_invites_accept_error_429(): + ec = _async_error_client(429) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.invites.accept({"key": "test-key"}) + assert exc_info.value.status == 429 + finally: + await ec.close() diff --git a/tests/contract/v1/test_knowledge_documents.py b/tests/contract/v1/test_knowledge_documents.py index bfea4c4..6b30a4b 100644 --- a/tests/contract/v1/test_knowledge_documents.py +++ b/tests/contract/v1/test_knowledge_documents.py @@ -1,10 +1,10 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: cc380ce0af5a +# Content hash: 47fc16d80b6c import pytest -from archastro.platform import PlatformClient +from archastro.platform import AsyncPlatformClient, PlatformClient from archastro.platform.runtime.http_client import ApiError PRISM_URL = "http://127.0.0.1:4040" @@ -26,111 +26,349 @@ def _error_client(code: int) -> PlatformClient: ) -async def test_knowledge_documents_list_success(): +def _async_client() -> AsyncPlatformClient: + return AsyncPlatformClient( + base_url=PRISM_URL, + default_headers={"x-archastro-api-key": "pk_test-key"}, + access_token="test-token", + ) + + +def _async_error_client(code: int) -> AsyncPlatformClient: + return AsyncPlatformClient( + base_url=PRISM_URL, + default_headers={"x-archastro-api-key": "pk_test-key", "Prefer": f"code={code}"}, + access_token="test-token", + ) + + +def test_knowledge_documents_list_success(): client = _client() - result = await client.v1.knowledge_documents.list() - assert result is not None - assert "data" in result - assert isinstance(result["data"], list) + try: + result = client.v1.knowledge_documents.list() + assert result is not None + assert "data" in result + assert isinstance(result["data"], list) + finally: + client.close() -async def test_knowledge_documents_list_error_401(): +def test_knowledge_documents_list_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.knowledge_documents.list() - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.knowledge_documents.list() + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_knowledge_documents_list_error_403(): +def test_knowledge_documents_list_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.knowledge_documents.list() - assert exc_info.value.status == 403 - - -async def test_knowledge_documents_delete_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.knowledge_documents.list() + assert exc_info.value.status == 403 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_knowledge_documents_list_success(): + client = _async_client() + try: + result = await client.v1.knowledge_documents.list() + assert result is not None + assert "data" in result + assert isinstance(result["data"], list) + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_knowledge_documents_list_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.knowledge_documents.list() + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_knowledge_documents_list_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.knowledge_documents.list() + assert exc_info.value.status == 403 + finally: + await ec.close() + + +def test_knowledge_documents_delete_success(): client = _client() - result = await client.v1.knowledge_documents.delete("test-value") - assert result is None + try: + result = client.v1.knowledge_documents.delete("test-value") + assert result is None + finally: + client.close() -async def test_knowledge_documents_delete_error_401(): +def test_knowledge_documents_delete_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.knowledge_documents.delete("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.knowledge_documents.delete("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_knowledge_documents_delete_error_403(): +def test_knowledge_documents_delete_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.knowledge_documents.delete("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.knowledge_documents.delete("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_knowledge_documents_delete_error_404(): +def test_knowledge_documents_delete_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.knowledge_documents.delete("test-value") - assert exc_info.value.status == 404 - - -async def test_knowledge_documents_get_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.knowledge_documents.delete("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_knowledge_documents_delete_success(): + client = _async_client() + try: + result = await client.v1.knowledge_documents.delete("test-value") + assert result is None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_knowledge_documents_delete_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.knowledge_documents.delete("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_knowledge_documents_delete_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.knowledge_documents.delete("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_knowledge_documents_delete_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.knowledge_documents.delete("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +def test_knowledge_documents_get_success(): client = _client() - result = await client.v1.knowledge_documents.get("test-value") - assert result is not None + try: + result = client.v1.knowledge_documents.get("test-value") + assert result is not None + finally: + client.close() -async def test_knowledge_documents_get_error_401(): +def test_knowledge_documents_get_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.knowledge_documents.get("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.knowledge_documents.get("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_knowledge_documents_get_error_403(): +def test_knowledge_documents_get_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.knowledge_documents.get("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.knowledge_documents.get("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_knowledge_documents_get_error_404(): +def test_knowledge_documents_get_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.knowledge_documents.get("test-value") - assert exc_info.value.status == 404 - - -async def test_knowledge_documents_content_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.knowledge_documents.get("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_knowledge_documents_get_success(): + client = _async_client() + try: + result = await client.v1.knowledge_documents.get("test-value") + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_knowledge_documents_get_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.knowledge_documents.get("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_knowledge_documents_get_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.knowledge_documents.get("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_knowledge_documents_get_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.knowledge_documents.get("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +def test_knowledge_documents_content_success(): client = _client() - result = await client.v1.knowledge_documents.content("test-value") - assert result is not None + try: + result = client.v1.knowledge_documents.content("test-value") + assert result is not None + finally: + client.close() -async def test_knowledge_documents_content_error_401(): +def test_knowledge_documents_content_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.knowledge_documents.content("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.knowledge_documents.content("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_knowledge_documents_content_error_403(): +def test_knowledge_documents_content_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.knowledge_documents.content("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.knowledge_documents.content("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_knowledge_documents_content_error_404(): +def test_knowledge_documents_content_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.knowledge_documents.content("test-value") - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.knowledge_documents.content("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() -async def test_knowledge_documents_content_error_422(): +def test_knowledge_documents_content_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.knowledge_documents.content("test-value") - assert exc_info.value.status == 422 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.knowledge_documents.content("test-value") + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_knowledge_documents_content_success(): + client = _async_client() + try: + result = await client.v1.knowledge_documents.content("test-value") + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_knowledge_documents_content_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.knowledge_documents.content("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_knowledge_documents_content_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.knowledge_documents.content("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_knowledge_documents_content_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.knowledge_documents.content("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_knowledge_documents_content_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.knowledge_documents.content("test-value") + assert exc_info.value.status == 422 + finally: + await ec.close() diff --git a/tests/contract/v1/test_knowledge_sources.py b/tests/contract/v1/test_knowledge_sources.py index 9899fb9..39b4077 100644 --- a/tests/contract/v1/test_knowledge_sources.py +++ b/tests/contract/v1/test_knowledge_sources.py @@ -1,10 +1,10 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: c39b66641823 +# Content hash: bc581d66b6bf import pytest -from archastro.platform import PlatformClient +from archastro.platform import AsyncPlatformClient, PlatformClient from archastro.platform.runtime.http_client import ApiError PRISM_URL = "http://127.0.0.1:4040" @@ -26,199 +26,616 @@ def _error_client(code: int) -> PlatformClient: ) -async def test_knowledge_sources_list_success(): +def _async_client() -> AsyncPlatformClient: + return AsyncPlatformClient( + base_url=PRISM_URL, + default_headers={"x-archastro-api-key": "pk_test-key"}, + access_token="test-token", + ) + + +def _async_error_client(code: int) -> AsyncPlatformClient: + return AsyncPlatformClient( + base_url=PRISM_URL, + default_headers={"x-archastro-api-key": "pk_test-key", "Prefer": f"code={code}"}, + access_token="test-token", + ) + + +def test_knowledge_sources_list_success(): client = _client() - result = await client.v1.knowledge_sources.list() - assert result is not None - assert "data" in result - assert isinstance(result["data"], list) + try: + result = client.v1.knowledge_sources.list() + assert result is not None + assert "data" in result + assert isinstance(result["data"], list) + finally: + client.close() -async def test_knowledge_sources_list_error_401(): +def test_knowledge_sources_list_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.knowledge_sources.list() - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.knowledge_sources.list() + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_knowledge_sources_list_error_403(): +def test_knowledge_sources_list_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.knowledge_sources.list() - assert exc_info.value.status == 403 - - -async def test_knowledge_sources_create_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.knowledge_sources.list() + assert exc_info.value.status == 403 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_knowledge_sources_list_success(): + client = _async_client() + try: + result = await client.v1.knowledge_sources.list() + assert result is not None + assert "data" in result + assert isinstance(result["data"], list) + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_knowledge_sources_list_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.knowledge_sources.list() + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_knowledge_sources_list_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.knowledge_sources.list() + assert exc_info.value.status == 403 + finally: + await ec.close() + + +def test_knowledge_sources_create_success(): client = _client() - result = await client.v1.knowledge_sources.create({"type": "test"}) - assert result is not None + try: + result = client.v1.knowledge_sources.create({"type": "test"}) + assert result is not None + finally: + client.close() -async def test_knowledge_sources_create_error_401(): +def test_knowledge_sources_create_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.knowledge_sources.create({"type": "test"}) - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.knowledge_sources.create({"type": "test"}) + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_knowledge_sources_create_error_403(): +def test_knowledge_sources_create_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.knowledge_sources.create({"type": "test"}) - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.knowledge_sources.create({"type": "test"}) + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_knowledge_sources_create_error_422(): +def test_knowledge_sources_create_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.knowledge_sources.create({"type": "test"}) - assert exc_info.value.status == 422 - - -async def test_knowledge_sources_delete_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.knowledge_sources.create({"type": "test"}) + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_knowledge_sources_create_success(): + client = _async_client() + try: + result = await client.v1.knowledge_sources.create({"type": "test"}) + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_knowledge_sources_create_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.knowledge_sources.create({"type": "test"}) + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_knowledge_sources_create_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.knowledge_sources.create({"type": "test"}) + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_knowledge_sources_create_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.knowledge_sources.create({"type": "test"}) + assert exc_info.value.status == 422 + finally: + await ec.close() + + +def test_knowledge_sources_delete_success(): client = _client() - result = await client.v1.knowledge_sources.delete("test-value") - assert result is None + try: + result = client.v1.knowledge_sources.delete("test-value") + assert result is None + finally: + client.close() -async def test_knowledge_sources_delete_error_401(): +def test_knowledge_sources_delete_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.knowledge_sources.delete("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.knowledge_sources.delete("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_knowledge_sources_delete_error_403(): +def test_knowledge_sources_delete_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.knowledge_sources.delete("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.knowledge_sources.delete("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_knowledge_sources_delete_error_404(): +def test_knowledge_sources_delete_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.knowledge_sources.delete("test-value") - assert exc_info.value.status == 404 - - -async def test_knowledge_sources_get_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.knowledge_sources.delete("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_knowledge_sources_delete_success(): + client = _async_client() + try: + result = await client.v1.knowledge_sources.delete("test-value") + assert result is None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_knowledge_sources_delete_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.knowledge_sources.delete("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_knowledge_sources_delete_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.knowledge_sources.delete("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_knowledge_sources_delete_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.knowledge_sources.delete("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +def test_knowledge_sources_get_success(): client = _client() - result = await client.v1.knowledge_sources.get("test-value") - assert result is not None + try: + result = client.v1.knowledge_sources.get("test-value") + assert result is not None + finally: + client.close() -async def test_knowledge_sources_get_error_401(): +def test_knowledge_sources_get_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.knowledge_sources.get("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.knowledge_sources.get("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_knowledge_sources_get_error_403(): +def test_knowledge_sources_get_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.knowledge_sources.get("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.knowledge_sources.get("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_knowledge_sources_get_error_404(): +def test_knowledge_sources_get_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.knowledge_sources.get("test-value") - assert exc_info.value.status == 404 - - -async def test_knowledge_sources_update_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.knowledge_sources.get("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_knowledge_sources_get_success(): + client = _async_client() + try: + result = await client.v1.knowledge_sources.get("test-value") + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_knowledge_sources_get_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.knowledge_sources.get("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_knowledge_sources_get_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.knowledge_sources.get("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_knowledge_sources_get_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.knowledge_sources.get("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +def test_knowledge_sources_update_success(): client = _client() - result = await client.v1.knowledge_sources.update("test-value", {}) - assert result is not None + try: + result = client.v1.knowledge_sources.update("test-value", {}) + assert result is not None + finally: + client.close() -async def test_knowledge_sources_update_error_401(): +def test_knowledge_sources_update_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.knowledge_sources.update("test-value", {}) - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.knowledge_sources.update("test-value", {}) + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_knowledge_sources_update_error_403(): +def test_knowledge_sources_update_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.knowledge_sources.update("test-value", {}) - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.knowledge_sources.update("test-value", {}) + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_knowledge_sources_update_error_404(): +def test_knowledge_sources_update_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.knowledge_sources.update("test-value", {}) - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.knowledge_sources.update("test-value", {}) + assert exc_info.value.status == 404 + finally: + ec.close() -async def test_knowledge_sources_update_error_422(): +def test_knowledge_sources_update_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.knowledge_sources.update("test-value", {}) - assert exc_info.value.status == 422 - - -async def test_knowledge_sources_ingest_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.knowledge_sources.update("test-value", {}) + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_knowledge_sources_update_success(): + client = _async_client() + try: + result = await client.v1.knowledge_sources.update("test-value", {}) + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_knowledge_sources_update_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.knowledge_sources.update("test-value", {}) + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_knowledge_sources_update_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.knowledge_sources.update("test-value", {}) + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_knowledge_sources_update_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.knowledge_sources.update("test-value", {}) + assert exc_info.value.status == 404 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_knowledge_sources_update_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.knowledge_sources.update("test-value", {}) + assert exc_info.value.status == 422 + finally: + await ec.close() + + +def test_knowledge_sources_ingest_success(): client = _client() - result = await client.v1.knowledge_sources.ingest("test-value", {}) - assert result is not None + try: + result = client.v1.knowledge_sources.ingest("test-value", {}) + assert result is not None + finally: + client.close() -async def test_knowledge_sources_ingest_error_401(): +def test_knowledge_sources_ingest_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.knowledge_sources.ingest("test-value", {}) - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.knowledge_sources.ingest("test-value", {}) + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_knowledge_sources_ingest_error_403(): +def test_knowledge_sources_ingest_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.knowledge_sources.ingest("test-value", {}) - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.knowledge_sources.ingest("test-value", {}) + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_knowledge_sources_ingest_error_404(): +def test_knowledge_sources_ingest_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.knowledge_sources.ingest("test-value", {}) - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.knowledge_sources.ingest("test-value", {}) + assert exc_info.value.status == 404 + finally: + ec.close() -async def test_knowledge_sources_ingest_error_422(): +def test_knowledge_sources_ingest_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.knowledge_sources.ingest("test-value", {}) - assert exc_info.value.status == 422 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.knowledge_sources.ingest("test-value", {}) + assert exc_info.value.status == 422 + finally: + ec.close() -async def test_knowledge_sources_ingest_error_429(): +def test_knowledge_sources_ingest_error_429(): ec = _error_client(429) - with pytest.raises(ApiError) as exc_info: - await ec.v1.knowledge_sources.ingest("test-value", {}) - assert exc_info.value.status == 429 - - -async def test_knowledge_sources_kinds_list_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.knowledge_sources.ingest("test-value", {}) + assert exc_info.value.status == 429 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_knowledge_sources_ingest_success(): + client = _async_client() + try: + result = await client.v1.knowledge_sources.ingest("test-value", {}) + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_knowledge_sources_ingest_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.knowledge_sources.ingest("test-value", {}) + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_knowledge_sources_ingest_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.knowledge_sources.ingest("test-value", {}) + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_knowledge_sources_ingest_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.knowledge_sources.ingest("test-value", {}) + assert exc_info.value.status == 404 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_knowledge_sources_ingest_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.knowledge_sources.ingest("test-value", {}) + assert exc_info.value.status == 422 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_knowledge_sources_ingest_error_429(): + ec = _async_error_client(429) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.knowledge_sources.ingest("test-value", {}) + assert exc_info.value.status == 429 + finally: + await ec.close() + + +def test_knowledge_sources_kinds_list_success(): client = _client() - result = await client.v1.knowledge_sources.kinds.list() - assert result is not None + try: + result = client.v1.knowledge_sources.kinds.list() + assert result is not None + finally: + client.close() -async def test_knowledge_sources_kinds_list_error_401(): +def test_knowledge_sources_kinds_list_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.knowledge_sources.kinds.list() - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.knowledge_sources.kinds.list() + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_knowledge_sources_kinds_list_error_403(): +def test_knowledge_sources_kinds_list_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.knowledge_sources.kinds.list() - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.knowledge_sources.kinds.list() + assert exc_info.value.status == 403 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_knowledge_sources_kinds_list_success(): + client = _async_client() + try: + result = await client.v1.knowledge_sources.kinds.list() + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_knowledge_sources_kinds_list_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.knowledge_sources.kinds.list() + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_knowledge_sources_kinds_list_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.knowledge_sources.kinds.list() + assert exc_info.value.status == 403 + finally: + await ec.close() diff --git a/tests/contract/v1/test_kv.py b/tests/contract/v1/test_kv.py index 83226b3..60e5447 100644 --- a/tests/contract/v1/test_kv.py +++ b/tests/contract/v1/test_kv.py @@ -1,10 +1,10 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: bb54dd6c40ce +# Content hash: 0210d44edbb2 import pytest -from archastro.platform import PlatformClient +from archastro.platform import AsyncPlatformClient, PlatformClient from archastro.platform.runtime.http_client import ApiError PRISM_URL = "http://127.0.0.1:4040" @@ -26,178 +26,553 @@ def _error_client(code: int) -> PlatformClient: ) -async def test_kv_list_success(): +def _async_client() -> AsyncPlatformClient: + return AsyncPlatformClient( + base_url=PRISM_URL, + default_headers={"x-archastro-api-key": "pk_test-key"}, + access_token="test-token", + ) + + +def _async_error_client(code: int) -> AsyncPlatformClient: + return AsyncPlatformClient( + base_url=PRISM_URL, + default_headers={"x-archastro-api-key": "pk_test-key", "Prefer": f"code={code}"}, + access_token="test-token", + ) + + +def test_kv_list_success(): client = _client() - result = await client.v1.kv.list() - assert result is not None + try: + result = client.v1.kv.list() + assert result is not None + finally: + client.close() -async def test_kv_list_error_400(): +def test_kv_list_error_400(): ec = _error_client(400) - with pytest.raises(ApiError) as exc_info: - await ec.v1.kv.list() - assert exc_info.value.status == 400 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.kv.list() + assert exc_info.value.status == 400 + finally: + ec.close() -async def test_kv_list_error_401(): +def test_kv_list_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.kv.list() - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.kv.list() + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_kv_list_error_403(): +def test_kv_list_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.kv.list() - assert exc_info.value.status == 403 - - -async def test_kv_create_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.kv.list() + assert exc_info.value.status == 403 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_kv_list_success(): + client = _async_client() + try: + result = await client.v1.kv.list() + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_kv_list_error_400(): + ec = _async_error_client(400) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.kv.list() + assert exc_info.value.status == 400 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_kv_list_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.kv.list() + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_kv_list_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.kv.list() + assert exc_info.value.status == 403 + finally: + await ec.close() + + +def test_kv_create_success(): client = _client() - result = await client.v1.kv.create({"key": "test-key", "value": "test-value"}) - assert result is not None + try: + result = client.v1.kv.create({"key": "test-key", "value": "test-value"}) + assert result is not None + finally: + client.close() -async def test_kv_create_error_400(): +def test_kv_create_error_400(): ec = _error_client(400) - with pytest.raises(ApiError) as exc_info: - await ec.v1.kv.create({"key": "test-key", "value": "test-value"}) - assert exc_info.value.status == 400 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.kv.create({"key": "test-key", "value": "test-value"}) + assert exc_info.value.status == 400 + finally: + ec.close() -async def test_kv_create_error_401(): +def test_kv_create_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.kv.create({"key": "test-key", "value": "test-value"}) - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.kv.create({"key": "test-key", "value": "test-value"}) + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_kv_create_error_403(): +def test_kv_create_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.kv.create({"key": "test-key", "value": "test-value"}) - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.kv.create({"key": "test-key", "value": "test-value"}) + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_kv_create_error_404(): +def test_kv_create_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.kv.create({"key": "test-key", "value": "test-value"}) - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.kv.create({"key": "test-key", "value": "test-value"}) + assert exc_info.value.status == 404 + finally: + ec.close() -async def test_kv_create_error_422(): +def test_kv_create_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.kv.create({"key": "test-key", "value": "test-value"}) - assert exc_info.value.status == 422 - - -async def test_kv_delete_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.kv.create({"key": "test-key", "value": "test-value"}) + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_kv_create_success(): + client = _async_client() + try: + result = await client.v1.kv.create({"key": "test-key", "value": "test-value"}) + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_kv_create_error_400(): + ec = _async_error_client(400) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.kv.create({"key": "test-key", "value": "test-value"}) + assert exc_info.value.status == 400 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_kv_create_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.kv.create({"key": "test-key", "value": "test-value"}) + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_kv_create_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.kv.create({"key": "test-key", "value": "test-value"}) + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_kv_create_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.kv.create({"key": "test-key", "value": "test-value"}) + assert exc_info.value.status == 404 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_kv_create_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.kv.create({"key": "test-key", "value": "test-value"}) + assert exc_info.value.status == 422 + finally: + await ec.close() + + +def test_kv_delete_success(): client = _client() - result = await client.v1.kv.delete("test-key") - assert result is None + try: + result = client.v1.kv.delete("test-key") + assert result is None + finally: + client.close() -async def test_kv_delete_error_400(): +def test_kv_delete_error_400(): ec = _error_client(400) - with pytest.raises(ApiError) as exc_info: - await ec.v1.kv.delete("test-key") - assert exc_info.value.status == 400 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.kv.delete("test-key") + assert exc_info.value.status == 400 + finally: + ec.close() -async def test_kv_delete_error_401(): +def test_kv_delete_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.kv.delete("test-key") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.kv.delete("test-key") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_kv_delete_error_403(): +def test_kv_delete_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.kv.delete("test-key") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.kv.delete("test-key") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_kv_delete_error_404(): +def test_kv_delete_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.kv.delete("test-key") - assert exc_info.value.status == 404 - - -async def test_kv_get_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.kv.delete("test-key") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_kv_delete_success(): + client = _async_client() + try: + result = await client.v1.kv.delete("test-key") + assert result is None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_kv_delete_error_400(): + ec = _async_error_client(400) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.kv.delete("test-key") + assert exc_info.value.status == 400 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_kv_delete_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.kv.delete("test-key") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_kv_delete_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.kv.delete("test-key") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_kv_delete_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.kv.delete("test-key") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +def test_kv_get_success(): client = _client() - result = await client.v1.kv.get("test-key") - assert result is not None + try: + result = client.v1.kv.get("test-key") + assert result is not None + finally: + client.close() -async def test_kv_get_error_400(): +def test_kv_get_error_400(): ec = _error_client(400) - with pytest.raises(ApiError) as exc_info: - await ec.v1.kv.get("test-key") - assert exc_info.value.status == 400 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.kv.get("test-key") + assert exc_info.value.status == 400 + finally: + ec.close() -async def test_kv_get_error_401(): +def test_kv_get_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.kv.get("test-key") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.kv.get("test-key") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_kv_get_error_403(): +def test_kv_get_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.kv.get("test-key") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.kv.get("test-key") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_kv_get_error_404(): +def test_kv_get_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.kv.get("test-key") - assert exc_info.value.status == 404 - - -async def test_kv_upsert_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.kv.get("test-key") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_kv_get_success(): + client = _async_client() + try: + result = await client.v1.kv.get("test-key") + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_kv_get_error_400(): + ec = _async_error_client(400) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.kv.get("test-key") + assert exc_info.value.status == 400 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_kv_get_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.kv.get("test-key") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_kv_get_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.kv.get("test-key") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_kv_get_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.kv.get("test-key") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +def test_kv_upsert_success(): client = _client() - result = await client.v1.kv.upsert("test-key", {"value": "test-value"}) - assert result is not None + try: + result = client.v1.kv.upsert("test-key", {"value": "test-value"}) + assert result is not None + finally: + client.close() -async def test_kv_upsert_error_400(): +def test_kv_upsert_error_400(): ec = _error_client(400) - with pytest.raises(ApiError) as exc_info: - await ec.v1.kv.upsert("test-key", {"value": "test-value"}) - assert exc_info.value.status == 400 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.kv.upsert("test-key", {"value": "test-value"}) + assert exc_info.value.status == 400 + finally: + ec.close() -async def test_kv_upsert_error_401(): +def test_kv_upsert_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.kv.upsert("test-key", {"value": "test-value"}) - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.kv.upsert("test-key", {"value": "test-value"}) + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_kv_upsert_error_403(): +def test_kv_upsert_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.kv.upsert("test-key", {"value": "test-value"}) - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.kv.upsert("test-key", {"value": "test-value"}) + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_kv_upsert_error_404(): +def test_kv_upsert_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.kv.upsert("test-key", {"value": "test-value"}) - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.kv.upsert("test-key", {"value": "test-value"}) + assert exc_info.value.status == 404 + finally: + ec.close() -async def test_kv_upsert_error_422(): +def test_kv_upsert_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.kv.upsert("test-key", {"value": "test-value"}) - assert exc_info.value.status == 422 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.kv.upsert("test-key", {"value": "test-value"}) + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_kv_upsert_success(): + client = _async_client() + try: + result = await client.v1.kv.upsert("test-key", {"value": "test-value"}) + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_kv_upsert_error_400(): + ec = _async_error_client(400) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.kv.upsert("test-key", {"value": "test-value"}) + assert exc_info.value.status == 400 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_kv_upsert_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.kv.upsert("test-key", {"value": "test-value"}) + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_kv_upsert_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.kv.upsert("test-key", {"value": "test-value"}) + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_kv_upsert_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.kv.upsert("test-key", {"value": "test-value"}) + assert exc_info.value.status == 404 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_kv_upsert_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.kv.upsert("test-key", {"value": "test-value"}) + assert exc_info.value.status == 422 + finally: + await ec.close() diff --git a/tests/contract/v1/test_notification_preferences.py b/tests/contract/v1/test_notification_preferences.py index 2ad952a..cf41b81 100644 --- a/tests/contract/v1/test_notification_preferences.py +++ b/tests/contract/v1/test_notification_preferences.py @@ -1,10 +1,10 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: f862bc13b8c0 +# Content hash: 5d9a4bc8b678 import pytest -from archastro.platform import PlatformClient +from archastro.platform import AsyncPlatformClient, PlatformClient from archastro.platform.runtime.http_client import ApiError PRISM_URL = "http://127.0.0.1:4040" @@ -26,83 +26,258 @@ def _error_client(code: int) -> PlatformClient: ) -async def test_notification_preferences_remove_success(): +def _async_client() -> AsyncPlatformClient: + return AsyncPlatformClient( + base_url=PRISM_URL, + default_headers={"x-archastro-api-key": "pk_test-key"}, + access_token="test-token", + ) + + +def _async_error_client(code: int) -> AsyncPlatformClient: + return AsyncPlatformClient( + base_url=PRISM_URL, + default_headers={"x-archastro-api-key": "pk_test-key", "Prefer": f"code={code}"}, + access_token="test-token", + ) + + +def test_notification_preferences_remove_success(): client = _client() - result = await client.v1.notification_preferences.remove() - assert result is None + try: + result = client.v1.notification_preferences.remove() + assert result is None + finally: + client.close() -async def test_notification_preferences_remove_error_401(): +def test_notification_preferences_remove_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.notification_preferences.remove() - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.notification_preferences.remove() + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_notification_preferences_remove_error_403(): +def test_notification_preferences_remove_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.notification_preferences.remove() - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.notification_preferences.remove() + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_notification_preferences_remove_error_404(): +def test_notification_preferences_remove_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.notification_preferences.remove() - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.notification_preferences.remove() + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_notification_preferences_remove_success(): + client = _async_client() + try: + result = await client.v1.notification_preferences.remove() + assert result is None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_notification_preferences_remove_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.notification_preferences.remove() + assert exc_info.value.status == 401 + finally: + await ec.close() -async def test_notification_preferences_list_success(): +@pytest.mark.asyncio +async def test_async_notification_preferences_remove_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.notification_preferences.remove() + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_notification_preferences_remove_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.notification_preferences.remove() + assert exc_info.value.status == 404 + finally: + await ec.close() + + +def test_notification_preferences_list_success(): client = _client() - result = await client.v1.notification_preferences.list() - assert result is not None + try: + result = client.v1.notification_preferences.list() + assert result is not None + finally: + client.close() -async def test_notification_preferences_list_error_401(): +def test_notification_preferences_list_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.notification_preferences.list() - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.notification_preferences.list() + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_notification_preferences_list_error_403(): +def test_notification_preferences_list_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.notification_preferences.list() - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.notification_preferences.list() + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_notification_preferences_replace_success(): - client = _client() - result = await client.v1.notification_preferences.replace( - {"channel": "test-value", "enabled": True, "type": "test"} - ) - assert result is not None +@pytest.mark.asyncio +async def test_async_notification_preferences_list_success(): + client = _async_client() + try: + result = await client.v1.notification_preferences.list() + assert result is not None + finally: + await client.close() -async def test_notification_preferences_replace_error_401(): - ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.notification_preferences.replace( +@pytest.mark.asyncio +async def test_async_notification_preferences_list_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.notification_preferences.list() + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_notification_preferences_list_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.notification_preferences.list() + assert exc_info.value.status == 403 + finally: + await ec.close() + + +def test_notification_preferences_replace_success(): + client = _client() + try: + result = client.v1.notification_preferences.replace( {"channel": "test-value", "enabled": True, "type": "test"} ) - assert exc_info.value.status == 401 + assert result is not None + finally: + client.close() + + +def test_notification_preferences_replace_error_401(): + ec = _error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.notification_preferences.replace( + {"channel": "test-value", "enabled": True, "type": "test"} + ) + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_notification_preferences_replace_error_403(): +def test_notification_preferences_replace_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.notification_preferences.replace( - {"channel": "test-value", "enabled": True, "type": "test"} - ) - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.notification_preferences.replace( + {"channel": "test-value", "enabled": True, "type": "test"} + ) + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_notification_preferences_replace_error_422(): +def test_notification_preferences_replace_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.notification_preferences.replace( + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.notification_preferences.replace( + {"channel": "test-value", "enabled": True, "type": "test"} + ) + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_notification_preferences_replace_success(): + client = _async_client() + try: + result = await client.v1.notification_preferences.replace( {"channel": "test-value", "enabled": True, "type": "test"} ) - assert exc_info.value.status == 422 + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_notification_preferences_replace_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.notification_preferences.replace( + {"channel": "test-value", "enabled": True, "type": "test"} + ) + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_notification_preferences_replace_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.notification_preferences.replace( + {"channel": "test-value", "enabled": True, "type": "test"} + ) + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_notification_preferences_replace_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.notification_preferences.replace( + {"channel": "test-value", "enabled": True, "type": "test"} + ) + assert exc_info.value.status == 422 + finally: + await ec.close() diff --git a/tests/contract/v1/test_notifications.py b/tests/contract/v1/test_notifications.py index 395f7aa..6717819 100644 --- a/tests/contract/v1/test_notifications.py +++ b/tests/contract/v1/test_notifications.py @@ -1,10 +1,10 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: 7c4afc87755c +# Content hash: 1c6ea0f28ef6 import pytest -from archastro.platform import PlatformClient +from archastro.platform import AsyncPlatformClient, PlatformClient from archastro.platform.runtime.http_client import ApiError PRISM_URL = "http://127.0.0.1:4040" @@ -26,192 +26,595 @@ def _error_client(code: int) -> PlatformClient: ) -async def test_notifications_list_success(): +def _async_client() -> AsyncPlatformClient: + return AsyncPlatformClient( + base_url=PRISM_URL, + default_headers={"x-archastro-api-key": "pk_test-key"}, + access_token="test-token", + ) + + +def _async_error_client(code: int) -> AsyncPlatformClient: + return AsyncPlatformClient( + base_url=PRISM_URL, + default_headers={"x-archastro-api-key": "pk_test-key", "Prefer": f"code={code}"}, + access_token="test-token", + ) + + +def test_notifications_list_success(): client = _client() - result = await client.v1.notifications.list() - assert result is not None - assert "data" in result - assert isinstance(result["data"], list) + try: + result = client.v1.notifications.list() + assert result is not None + assert "data" in result + assert isinstance(result["data"], list) + finally: + client.close() -async def test_notifications_list_error_400(): +def test_notifications_list_error_400(): ec = _error_client(400) - with pytest.raises(ApiError) as exc_info: - await ec.v1.notifications.list() - assert exc_info.value.status == 400 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.notifications.list() + assert exc_info.value.status == 400 + finally: + ec.close() -async def test_notifications_list_error_401(): +def test_notifications_list_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.notifications.list() - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.notifications.list() + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_notifications_list_error_403(): +def test_notifications_list_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.notifications.list() - assert exc_info.value.status == 403 - - -async def test_notifications_read_all_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.notifications.list() + assert exc_info.value.status == 403 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_notifications_list_success(): + client = _async_client() + try: + result = await client.v1.notifications.list() + assert result is not None + assert "data" in result + assert isinstance(result["data"], list) + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_notifications_list_error_400(): + ec = _async_error_client(400) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.notifications.list() + assert exc_info.value.status == 400 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_notifications_list_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.notifications.list() + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_notifications_list_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.notifications.list() + assert exc_info.value.status == 403 + finally: + await ec.close() + + +def test_notifications_read_all_success(): client = _client() - result = await client.v1.notifications.read_all() - assert result is None + try: + result = client.v1.notifications.read_all() + assert result is None + finally: + client.close() -async def test_notifications_read_all_error_401(): +def test_notifications_read_all_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.notifications.read_all() - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.notifications.read_all() + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_notifications_read_all_error_403(): +def test_notifications_read_all_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.notifications.read_all() - assert exc_info.value.status == 403 - - -async def test_notifications_send_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.notifications.read_all() + assert exc_info.value.status == 403 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_notifications_read_all_success(): + client = _async_client() + try: + result = await client.v1.notifications.read_all() + assert result is None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_notifications_read_all_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.notifications.read_all() + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_notifications_read_all_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.notifications.read_all() + assert exc_info.value.status == 403 + finally: + await ec.close() + + +def test_notifications_send_success(): client = _client() - result = await client.v1.notifications.send({"type": "test", "user": "test-value"}) - assert result is not None + try: + result = client.v1.notifications.send({"type": "test", "user": "test-value"}) + assert result is not None + finally: + client.close() -async def test_notifications_send_error_400(): +def test_notifications_send_error_400(): ec = _error_client(400) - with pytest.raises(ApiError) as exc_info: - await ec.v1.notifications.send({"type": "test", "user": "test-value"}) - assert exc_info.value.status == 400 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.notifications.send({"type": "test", "user": "test-value"}) + assert exc_info.value.status == 400 + finally: + ec.close() -async def test_notifications_send_error_401(): +def test_notifications_send_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.notifications.send({"type": "test", "user": "test-value"}) - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.notifications.send({"type": "test", "user": "test-value"}) + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_notifications_send_error_403(): +def test_notifications_send_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.notifications.send({"type": "test", "user": "test-value"}) - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.notifications.send({"type": "test", "user": "test-value"}) + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_notifications_send_error_404(): +def test_notifications_send_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.notifications.send({"type": "test", "user": "test-value"}) - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.notifications.send({"type": "test", "user": "test-value"}) + assert exc_info.value.status == 404 + finally: + ec.close() -async def test_notifications_send_error_422(): +def test_notifications_send_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.notifications.send({"type": "test", "user": "test-value"}) - assert exc_info.value.status == 422 - - -async def test_notifications_unread_count_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.notifications.send({"type": "test", "user": "test-value"}) + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_notifications_send_success(): + client = _async_client() + try: + result = await client.v1.notifications.send({"type": "test", "user": "test-value"}) + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_notifications_send_error_400(): + ec = _async_error_client(400) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.notifications.send({"type": "test", "user": "test-value"}) + assert exc_info.value.status == 400 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_notifications_send_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.notifications.send({"type": "test", "user": "test-value"}) + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_notifications_send_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.notifications.send({"type": "test", "user": "test-value"}) + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_notifications_send_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.notifications.send({"type": "test", "user": "test-value"}) + assert exc_info.value.status == 404 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_notifications_send_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.notifications.send({"type": "test", "user": "test-value"}) + assert exc_info.value.status == 422 + finally: + await ec.close() + + +def test_notifications_unread_count_success(): client = _client() - result = await client.v1.notifications.unread_count() - assert result is not None + try: + result = client.v1.notifications.unread_count() + assert result is not None + finally: + client.close() -async def test_notifications_unread_count_error_401(): +def test_notifications_unread_count_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.notifications.unread_count() - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.notifications.unread_count() + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_notifications_unread_count_error_403(): +def test_notifications_unread_count_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.notifications.unread_count() - assert exc_info.value.status == 403 - - -async def test_notifications_archive_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.notifications.unread_count() + assert exc_info.value.status == 403 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_notifications_unread_count_success(): + client = _async_client() + try: + result = await client.v1.notifications.unread_count() + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_notifications_unread_count_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.notifications.unread_count() + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_notifications_unread_count_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.notifications.unread_count() + assert exc_info.value.status == 403 + finally: + await ec.close() + + +def test_notifications_archive_success(): client = _client() - result = await client.v1.notifications.archive("test-value") - assert result is None + try: + result = client.v1.notifications.archive("test-value") + assert result is None + finally: + client.close() -async def test_notifications_archive_error_401(): +def test_notifications_archive_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.notifications.archive("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.notifications.archive("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_notifications_archive_error_403(): +def test_notifications_archive_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.notifications.archive("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.notifications.archive("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_notifications_archive_error_404(): +def test_notifications_archive_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.notifications.archive("test-value") - assert exc_info.value.status == 404 - - -async def test_notifications_read_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.notifications.archive("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_notifications_archive_success(): + client = _async_client() + try: + result = await client.v1.notifications.archive("test-value") + assert result is None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_notifications_archive_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.notifications.archive("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_notifications_archive_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.notifications.archive("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_notifications_archive_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.notifications.archive("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +def test_notifications_read_success(): client = _client() - result = await client.v1.notifications.read("test-value") - assert result is None + try: + result = client.v1.notifications.read("test-value") + assert result is None + finally: + client.close() -async def test_notifications_read_error_401(): +def test_notifications_read_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.notifications.read("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.notifications.read("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_notifications_read_error_403(): +def test_notifications_read_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.notifications.read("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.notifications.read("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_notifications_read_error_404(): +def test_notifications_read_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.notifications.read("test-value") - assert exc_info.value.status == 404 - - -async def test_notifications_unarchive_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.notifications.read("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_notifications_read_success(): + client = _async_client() + try: + result = await client.v1.notifications.read("test-value") + assert result is None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_notifications_read_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.notifications.read("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_notifications_read_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.notifications.read("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_notifications_read_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.notifications.read("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +def test_notifications_unarchive_success(): client = _client() - result = await client.v1.notifications.unarchive("test-value") - assert result is None + try: + result = client.v1.notifications.unarchive("test-value") + assert result is None + finally: + client.close() -async def test_notifications_unarchive_error_401(): +def test_notifications_unarchive_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.notifications.unarchive("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.notifications.unarchive("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_notifications_unarchive_error_403(): +def test_notifications_unarchive_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.notifications.unarchive("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.notifications.unarchive("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_notifications_unarchive_error_404(): +def test_notifications_unarchive_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.notifications.unarchive("test-value") - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.notifications.unarchive("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_notifications_unarchive_success(): + client = _async_client() + try: + result = await client.v1.notifications.unarchive("test-value") + assert result is None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_notifications_unarchive_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.notifications.unarchive("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_notifications_unarchive_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.notifications.unarchive("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_notifications_unarchive_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.notifications.unarchive("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() diff --git a/tests/contract/v1/test_orgs.py b/tests/contract/v1/test_orgs.py index 7dbe3c8..1250ea7 100644 --- a/tests/contract/v1/test_orgs.py +++ b/tests/contract/v1/test_orgs.py @@ -1,10 +1,10 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: 33049a9d58cc +# Content hash: 8aa0af5a2a23 import pytest -from archastro.platform import PlatformClient +from archastro.platform import AsyncPlatformClient, PlatformClient from archastro.platform.runtime.http_client import ApiError PRISM_URL = "http://127.0.0.1:4040" @@ -26,23 +26,82 @@ def _error_client(code: int) -> PlatformClient: ) -async def test_orgs_list_success(): +def _async_client() -> AsyncPlatformClient: + return AsyncPlatformClient( + base_url=PRISM_URL, + default_headers={"x-archastro-api-key": "pk_test-key"}, + access_token="test-token", + ) + + +def _async_error_client(code: int) -> AsyncPlatformClient: + return AsyncPlatformClient( + base_url=PRISM_URL, + default_headers={"x-archastro-api-key": "pk_test-key", "Prefer": f"code={code}"}, + access_token="test-token", + ) + + +def test_orgs_list_success(): client = _client() - result = await client.v1.orgs.list() - assert result is not None - assert "data" in result - assert isinstance(result["data"], list) + try: + result = client.v1.orgs.list() + assert result is not None + assert "data" in result + assert isinstance(result["data"], list) + finally: + client.close() -async def test_orgs_list_error_401(): +def test_orgs_list_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.orgs.list() - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.orgs.list() + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_orgs_list_error_403(): +def test_orgs_list_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.orgs.list() - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.orgs.list() + assert exc_info.value.status == 403 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_orgs_list_success(): + client = _async_client() + try: + result = await client.v1.orgs.list() + assert result is not None + assert "data" in result + assert isinstance(result["data"], list) + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_orgs_list_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.orgs.list() + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_orgs_list_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.orgs.list() + assert exc_info.value.status == 403 + finally: + await ec.close() diff --git a/tests/contract/v1/test_solution_categories.py b/tests/contract/v1/test_solution_categories.py index ee2d100..7b7be8d 100644 --- a/tests/contract/v1/test_solution_categories.py +++ b/tests/contract/v1/test_solution_categories.py @@ -1,10 +1,10 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: 93af2ba1fa8e +# Content hash: 4073a175f74d import pytest -from archastro.platform import PlatformClient +from archastro.platform import AsyncPlatformClient, PlatformClient from archastro.platform.runtime.http_client import ApiError PRISM_URL = "http://127.0.0.1:4040" @@ -26,21 +26,78 @@ def _error_client(code: int) -> PlatformClient: ) -async def test_solution_categories_list_success(): +def _async_client() -> AsyncPlatformClient: + return AsyncPlatformClient( + base_url=PRISM_URL, + default_headers={"x-archastro-api-key": "pk_test-key"}, + access_token="test-token", + ) + + +def _async_error_client(code: int) -> AsyncPlatformClient: + return AsyncPlatformClient( + base_url=PRISM_URL, + default_headers={"x-archastro-api-key": "pk_test-key", "Prefer": f"code={code}"}, + access_token="test-token", + ) + + +def test_solution_categories_list_success(): client = _client() - result = await client.v1.solution_categories.list() - assert result is not None + try: + result = client.v1.solution_categories.list() + assert result is not None + finally: + client.close() -async def test_solution_categories_list_error_401(): +def test_solution_categories_list_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.solution_categories.list() - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.solution_categories.list() + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_solution_categories_list_error_403(): +def test_solution_categories_list_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.solution_categories.list() - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.solution_categories.list() + assert exc_info.value.status == 403 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_solution_categories_list_success(): + client = _async_client() + try: + result = await client.v1.solution_categories.list() + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_solution_categories_list_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.solution_categories.list() + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_solution_categories_list_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.solution_categories.list() + assert exc_info.value.status == 403 + finally: + await ec.close() diff --git a/tests/contract/v1/test_solution_tags.py b/tests/contract/v1/test_solution_tags.py index cf35c7b..8db2330 100644 --- a/tests/contract/v1/test_solution_tags.py +++ b/tests/contract/v1/test_solution_tags.py @@ -1,10 +1,10 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: 4938b886e44e +# Content hash: bf613d8f9ab3 import pytest -from archastro.platform import PlatformClient +from archastro.platform import AsyncPlatformClient, PlatformClient from archastro.platform.runtime.http_client import ApiError PRISM_URL = "http://127.0.0.1:4040" @@ -26,21 +26,78 @@ def _error_client(code: int) -> PlatformClient: ) -async def test_solution_tags_list_success(): +def _async_client() -> AsyncPlatformClient: + return AsyncPlatformClient( + base_url=PRISM_URL, + default_headers={"x-archastro-api-key": "pk_test-key"}, + access_token="test-token", + ) + + +def _async_error_client(code: int) -> AsyncPlatformClient: + return AsyncPlatformClient( + base_url=PRISM_URL, + default_headers={"x-archastro-api-key": "pk_test-key", "Prefer": f"code={code}"}, + access_token="test-token", + ) + + +def test_solution_tags_list_success(): client = _client() - result = await client.v1.solution_tags.list() - assert result is not None + try: + result = client.v1.solution_tags.list() + assert result is not None + finally: + client.close() -async def test_solution_tags_list_error_401(): +def test_solution_tags_list_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.solution_tags.list() - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.solution_tags.list() + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_solution_tags_list_error_403(): +def test_solution_tags_list_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.solution_tags.list() - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.solution_tags.list() + assert exc_info.value.status == 403 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_solution_tags_list_success(): + client = _async_client() + try: + result = await client.v1.solution_tags.list() + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_solution_tags_list_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.solution_tags.list() + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_solution_tags_list_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.solution_tags.list() + assert exc_info.value.status == 403 + finally: + await ec.close() diff --git a/tests/contract/v1/test_solutions.py b/tests/contract/v1/test_solutions.py index cc9318b..d039e04 100644 --- a/tests/contract/v1/test_solutions.py +++ b/tests/contract/v1/test_solutions.py @@ -1,10 +1,10 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: 6dce040e5f75 +# Content hash: 4d8e3660f3d3 import pytest -from archastro.platform import PlatformClient +from archastro.platform import AsyncPlatformClient, PlatformClient from archastro.platform.runtime.http_client import ApiError PRISM_URL = "http://127.0.0.1:4040" @@ -26,253 +26,780 @@ def _error_client(code: int) -> PlatformClient: ) -async def test_solutions_list_success(): +def _async_client() -> AsyncPlatformClient: + return AsyncPlatformClient( + base_url=PRISM_URL, + default_headers={"x-archastro-api-key": "pk_test-key"}, + access_token="test-token", + ) + + +def _async_error_client(code: int) -> AsyncPlatformClient: + return AsyncPlatformClient( + base_url=PRISM_URL, + default_headers={"x-archastro-api-key": "pk_test-key", "Prefer": f"code={code}"}, + access_token="test-token", + ) + + +def test_solutions_list_success(): client = _client() - result = await client.v1.solutions.list() - assert result is not None + try: + result = client.v1.solutions.list() + assert result is not None + finally: + client.close() -async def test_solutions_list_error_401(): +def test_solutions_list_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.solutions.list() - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.solutions.list() + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_solutions_list_error_403(): +def test_solutions_list_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.solutions.list() - assert exc_info.value.status == 403 - - -async def test_solutions_create_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.solutions.list() + assert exc_info.value.status == 403 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_solutions_list_success(): + client = _async_client() + try: + result = await client.v1.solutions.list() + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_solutions_list_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.solutions.list() + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_solutions_list_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.solutions.list() + assert exc_info.value.status == 403 + finally: + await ec.close() + + +def test_solutions_create_success(): client = _client() - result = await client.v1.solutions.create({}) - assert result is not None + try: + result = client.v1.solutions.create({}) + assert result is not None + finally: + client.close() -async def test_solutions_create_error_400(): +def test_solutions_create_error_400(): ec = _error_client(400) - with pytest.raises(ApiError) as exc_info: - await ec.v1.solutions.create({}) - assert exc_info.value.status == 400 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.solutions.create({}) + assert exc_info.value.status == 400 + finally: + ec.close() -async def test_solutions_create_error_401(): +def test_solutions_create_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.solutions.create({}) - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.solutions.create({}) + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_solutions_create_error_403(): +def test_solutions_create_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.solutions.create({}) - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.solutions.create({}) + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_solutions_create_error_404(): +def test_solutions_create_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.solutions.create({}) - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.solutions.create({}) + assert exc_info.value.status == 404 + finally: + ec.close() -async def test_solutions_create_error_409(): +def test_solutions_create_error_409(): ec = _error_client(409) - with pytest.raises(ApiError) as exc_info: - await ec.v1.solutions.create({}) - assert exc_info.value.status == 409 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.solutions.create({}) + assert exc_info.value.status == 409 + finally: + ec.close() -async def test_solutions_create_error_422(): +def test_solutions_create_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.solutions.create({}) - assert exc_info.value.status == 422 - - -async def test_solutions_delete_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.solutions.create({}) + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_solutions_create_success(): + client = _async_client() + try: + result = await client.v1.solutions.create({}) + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_solutions_create_error_400(): + ec = _async_error_client(400) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.solutions.create({}) + assert exc_info.value.status == 400 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_solutions_create_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.solutions.create({}) + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_solutions_create_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.solutions.create({}) + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_solutions_create_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.solutions.create({}) + assert exc_info.value.status == 404 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_solutions_create_error_409(): + ec = _async_error_client(409) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.solutions.create({}) + assert exc_info.value.status == 409 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_solutions_create_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.solutions.create({}) + assert exc_info.value.status == 422 + finally: + await ec.close() + + +def test_solutions_delete_success(): client = _client() - result = await client.v1.solutions.delete("test-value") - assert result is None + try: + result = client.v1.solutions.delete("test-value") + assert result is None + finally: + client.close() -async def test_solutions_delete_error_403(): +def test_solutions_delete_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.solutions.delete("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.solutions.delete("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_solutions_delete_error_404(): +def test_solutions_delete_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.solutions.delete("test-value") - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.solutions.delete("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() -async def test_solutions_delete_error_500(): +def test_solutions_delete_error_500(): ec = _error_client(500) - with pytest.raises(ApiError) as exc_info: - await ec.v1.solutions.delete("test-value") - assert exc_info.value.status == 500 - - -async def test_solutions_get_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.solutions.delete("test-value") + assert exc_info.value.status == 500 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_solutions_delete_success(): + client = _async_client() + try: + result = await client.v1.solutions.delete("test-value") + assert result is None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_solutions_delete_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.solutions.delete("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_solutions_delete_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.solutions.delete("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_solutions_delete_error_500(): + ec = _async_error_client(500) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.solutions.delete("test-value") + assert exc_info.value.status == 500 + finally: + await ec.close() + + +def test_solutions_get_success(): client = _client() - result = await client.v1.solutions.get("test-value") - assert result is not None + try: + result = client.v1.solutions.get("test-value") + assert result is not None + finally: + client.close() -async def test_solutions_get_error_401(): +def test_solutions_get_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.solutions.get("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.solutions.get("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_solutions_get_error_403(): +def test_solutions_get_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.solutions.get("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.solutions.get("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_solutions_get_error_404(): +def test_solutions_get_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.solutions.get("test-value") - assert exc_info.value.status == 404 - - -async def test_solutions_dependents_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.solutions.get("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_solutions_get_success(): + client = _async_client() + try: + result = await client.v1.solutions.get("test-value") + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_solutions_get_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.solutions.get("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_solutions_get_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.solutions.get("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_solutions_get_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.solutions.get("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +def test_solutions_dependents_success(): client = _client() - result = await client.v1.solutions.dependents("test-value") - assert result is not None + try: + result = client.v1.solutions.dependents("test-value") + assert result is not None + finally: + client.close() -async def test_solutions_dependents_error_403(): +def test_solutions_dependents_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.solutions.dependents("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.solutions.dependents("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_solutions_dependents_error_404(): +def test_solutions_dependents_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.solutions.dependents("test-value") - assert exc_info.value.status == 404 - - -async def test_solutions_install_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.solutions.dependents("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_solutions_dependents_success(): + client = _async_client() + try: + result = await client.v1.solutions.dependents("test-value") + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_solutions_dependents_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.solutions.dependents("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_solutions_dependents_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.solutions.dependents("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +def test_solutions_install_success(): client = _client() - result = await client.v1.solutions.install("test-value", {}) - assert result is not None + try: + result = client.v1.solutions.install("test-value", {}) + assert result is not None + finally: + client.close() -async def test_solutions_install_error_400(): +def test_solutions_install_error_400(): ec = _error_client(400) - with pytest.raises(ApiError) as exc_info: - await ec.v1.solutions.install("test-value", {}) - assert exc_info.value.status == 400 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.solutions.install("test-value", {}) + assert exc_info.value.status == 400 + finally: + ec.close() -async def test_solutions_install_error_401(): +def test_solutions_install_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.solutions.install("test-value", {}) - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.solutions.install("test-value", {}) + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_solutions_install_error_403(): +def test_solutions_install_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.solutions.install("test-value", {}) - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.solutions.install("test-value", {}) + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_solutions_install_error_404(): +def test_solutions_install_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.solutions.install("test-value", {}) - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.solutions.install("test-value", {}) + assert exc_info.value.status == 404 + finally: + ec.close() -async def test_solutions_install_error_409(): +def test_solutions_install_error_409(): ec = _error_client(409) - with pytest.raises(ApiError) as exc_info: - await ec.v1.solutions.install("test-value", {}) - assert exc_info.value.status == 409 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.solutions.install("test-value", {}) + assert exc_info.value.status == 409 + finally: + ec.close() -async def test_solutions_install_error_422(): +def test_solutions_install_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.solutions.install("test-value", {}) - assert exc_info.value.status == 422 - - -async def test_solutions_readme_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.solutions.install("test-value", {}) + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_solutions_install_success(): + client = _async_client() + try: + result = await client.v1.solutions.install("test-value", {}) + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_solutions_install_error_400(): + ec = _async_error_client(400) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.solutions.install("test-value", {}) + assert exc_info.value.status == 400 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_solutions_install_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.solutions.install("test-value", {}) + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_solutions_install_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.solutions.install("test-value", {}) + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_solutions_install_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.solutions.install("test-value", {}) + assert exc_info.value.status == 404 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_solutions_install_error_409(): + ec = _async_error_client(409) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.solutions.install("test-value", {}) + assert exc_info.value.status == 409 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_solutions_install_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.solutions.install("test-value", {}) + assert exc_info.value.status == 422 + finally: + await ec.close() + + +def test_solutions_readme_success(): client = _client() - result = await client.v1.solutions.readme("test-value", token="test-token") - assert result["content"] is not None - assert result["mime_type"] + try: + result = client.v1.solutions.readme("test-value", token="test-token") + assert result["content"] is not None + assert result["mime_type"] + finally: + client.close() -async def test_solutions_readme_error_401(): +def test_solutions_readme_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.solutions.readme("test-value", token="test-token") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.solutions.readme("test-value", token="test-token") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_solutions_readme_error_404(): +def test_solutions_readme_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.solutions.readme("test-value", token="test-token") - assert exc_info.value.status == 404 - - -async def test_solutions_upgrade_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.solutions.readme("test-value", token="test-token") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_solutions_readme_success(): + client = _async_client() + try: + result = await client.v1.solutions.readme("test-value", token="test-token") + assert result["content"] is not None + assert result["mime_type"] + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_solutions_readme_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.solutions.readme("test-value", token="test-token") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_solutions_readme_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.solutions.readme("test-value", token="test-token") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +def test_solutions_upgrade_success(): client = _client() - result = await client.v1.solutions.upgrade("test-value", {}) - assert result is not None + try: + result = client.v1.solutions.upgrade("test-value", {}) + assert result is not None + finally: + client.close() -async def test_solutions_upgrade_error_400(): +def test_solutions_upgrade_error_400(): ec = _error_client(400) - with pytest.raises(ApiError) as exc_info: - await ec.v1.solutions.upgrade("test-value", {}) - assert exc_info.value.status == 400 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.solutions.upgrade("test-value", {}) + assert exc_info.value.status == 400 + finally: + ec.close() -async def test_solutions_upgrade_error_403(): +def test_solutions_upgrade_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.solutions.upgrade("test-value", {}) - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.solutions.upgrade("test-value", {}) + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_solutions_upgrade_error_404(): +def test_solutions_upgrade_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.solutions.upgrade("test-value", {}) - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.solutions.upgrade("test-value", {}) + assert exc_info.value.status == 404 + finally: + ec.close() -async def test_solutions_upgrade_error_409(): +def test_solutions_upgrade_error_409(): ec = _error_client(409) - with pytest.raises(ApiError) as exc_info: - await ec.v1.solutions.upgrade("test-value", {}) - assert exc_info.value.status == 409 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.solutions.upgrade("test-value", {}) + assert exc_info.value.status == 409 + finally: + ec.close() -async def test_solutions_upgrade_error_422(): +def test_solutions_upgrade_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.solutions.upgrade("test-value", {}) - assert exc_info.value.status == 422 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.solutions.upgrade("test-value", {}) + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_solutions_upgrade_success(): + client = _async_client() + try: + result = await client.v1.solutions.upgrade("test-value", {}) + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_solutions_upgrade_error_400(): + ec = _async_error_client(400) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.solutions.upgrade("test-value", {}) + assert exc_info.value.status == 400 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_solutions_upgrade_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.solutions.upgrade("test-value", {}) + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_solutions_upgrade_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.solutions.upgrade("test-value", {}) + assert exc_info.value.status == 404 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_solutions_upgrade_error_409(): + ec = _async_error_client(409) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.solutions.upgrade("test-value", {}) + assert exc_info.value.status == 409 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_solutions_upgrade_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.solutions.upgrade("test-value", {}) + assert exc_info.value.status == 422 + finally: + await ec.close() diff --git a/tests/contract/v1/test_team_memberships.py b/tests/contract/v1/test_team_memberships.py index 93e94c6..d6f3e55 100644 --- a/tests/contract/v1/test_team_memberships.py +++ b/tests/contract/v1/test_team_memberships.py @@ -1,10 +1,10 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: 8394a4e65595 +# Content hash: 483e5c83f19d import pytest -from archastro.platform import PlatformClient +from archastro.platform import AsyncPlatformClient, PlatformClient from archastro.platform.runtime.http_client import ApiError PRISM_URL = "http://127.0.0.1:4040" @@ -26,41 +26,139 @@ def _error_client(code: int) -> PlatformClient: ) -async def test_team_memberships_list_success(): +def _async_client() -> AsyncPlatformClient: + return AsyncPlatformClient( + base_url=PRISM_URL, + default_headers={"x-archastro-api-key": "pk_test-key"}, + access_token="test-token", + ) + + +def _async_error_client(code: int) -> AsyncPlatformClient: + return AsyncPlatformClient( + base_url=PRISM_URL, + default_headers={"x-archastro-api-key": "pk_test-key", "Prefer": f"code={code}"}, + access_token="test-token", + ) + + +def test_team_memberships_list_success(): client = _client() - result = await client.v1.team_memberships.list() - assert result is not None + try: + result = client.v1.team_memberships.list() + assert result is not None + finally: + client.close() -async def test_team_memberships_list_error_401(): +def test_team_memberships_list_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.team_memberships.list() - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.team_memberships.list() + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_team_memberships_list_error_403(): +def test_team_memberships_list_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.team_memberships.list() - assert exc_info.value.status == 403 - - -async def test_team_memberships_delete_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.team_memberships.list() + assert exc_info.value.status == 403 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_team_memberships_list_success(): + client = _async_client() + try: + result = await client.v1.team_memberships.list() + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_team_memberships_list_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.team_memberships.list() + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_team_memberships_list_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.team_memberships.list() + assert exc_info.value.status == 403 + finally: + await ec.close() + + +def test_team_memberships_delete_success(): client = _client() - result = await client.v1.team_memberships.delete("test-value") - assert result is None + try: + result = client.v1.team_memberships.delete("test-value") + assert result is None + finally: + client.close() -async def test_team_memberships_delete_error_401(): +def test_team_memberships_delete_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.team_memberships.delete("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.team_memberships.delete("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_team_memberships_delete_error_404(): +def test_team_memberships_delete_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.team_memberships.delete("test-value") - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.team_memberships.delete("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_team_memberships_delete_success(): + client = _async_client() + try: + result = await client.v1.team_memberships.delete("test-value") + assert result is None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_team_memberships_delete_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.team_memberships.delete("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_team_memberships_delete_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.team_memberships.delete("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() diff --git a/tests/contract/v1/test_teams.py b/tests/contract/v1/test_teams.py index 3d5c85f..386f065 100644 --- a/tests/contract/v1/test_teams.py +++ b/tests/contract/v1/test_teams.py @@ -1,10 +1,10 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: a96cab1e52c2 +# Content hash: dddc177190e5 import pytest -from archastro.platform import PlatformClient +from archastro.platform import AsyncPlatformClient, PlatformClient from archastro.platform.runtime.http_client import ApiError PRISM_URL = "http://127.0.0.1:4040" @@ -26,567 +26,1721 @@ def _error_client(code: int) -> PlatformClient: ) -async def test_teams_list_success(): +def _async_client() -> AsyncPlatformClient: + return AsyncPlatformClient( + base_url=PRISM_URL, + default_headers={"x-archastro-api-key": "pk_test-key"}, + access_token="test-token", + ) + + +def _async_error_client(code: int) -> AsyncPlatformClient: + return AsyncPlatformClient( + base_url=PRISM_URL, + default_headers={"x-archastro-api-key": "pk_test-key", "Prefer": f"code={code}"}, + access_token="test-token", + ) + + +def test_teams_list_success(): client = _client() - result = await client.v1.teams.list() - assert result is not None - assert "data" in result - assert isinstance(result["data"], list) + try: + result = client.v1.teams.list() + assert result is not None + assert "data" in result + assert isinstance(result["data"], list) + finally: + client.close() -async def test_teams_list_error_400(): +def test_teams_list_error_400(): ec = _error_client(400) - with pytest.raises(ApiError) as exc_info: - await ec.v1.teams.list() - assert exc_info.value.status == 400 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.teams.list() + assert exc_info.value.status == 400 + finally: + ec.close() -async def test_teams_list_error_401(): +def test_teams_list_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.teams.list() - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.teams.list() + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_teams_list_error_403(): +def test_teams_list_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.teams.list() - assert exc_info.value.status == 403 - - -async def test_teams_create_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.teams.list() + assert exc_info.value.status == 403 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_teams_list_success(): + client = _async_client() + try: + result = await client.v1.teams.list() + assert result is not None + assert "data" in result + assert isinstance(result["data"], list) + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_teams_list_error_400(): + ec = _async_error_client(400) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.teams.list() + assert exc_info.value.status == 400 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_teams_list_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.teams.list() + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_teams_list_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.teams.list() + assert exc_info.value.status == 403 + finally: + await ec.close() + + +def test_teams_create_success(): client = _client() - result = await client.v1.teams.create({"name": "test-name"}) - assert result is not None + try: + result = client.v1.teams.create({"name": "test-name"}) + assert result is not None + finally: + client.close() -async def test_teams_create_error_401(): +def test_teams_create_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.teams.create({"name": "test-name"}) - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.teams.create({"name": "test-name"}) + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_teams_create_error_403(): +def test_teams_create_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.teams.create({"name": "test-name"}) - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.teams.create({"name": "test-name"}) + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_teams_create_error_422(): +def test_teams_create_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.teams.create({"name": "test-name"}) - assert exc_info.value.status == 422 - - -async def test_teams_join_by_code_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.teams.create({"name": "test-name"}) + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_teams_create_success(): + client = _async_client() + try: + result = await client.v1.teams.create({"name": "test-name"}) + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_teams_create_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.teams.create({"name": "test-name"}) + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_teams_create_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.teams.create({"name": "test-name"}) + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_teams_create_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.teams.create({"name": "test-name"}) + assert exc_info.value.status == 422 + finally: + await ec.close() + + +def test_teams_join_by_code_success(): client = _client() - result = await client.v1.teams.join_by_code({}) - assert result is not None + try: + result = client.v1.teams.join_by_code({}) + assert result is not None + finally: + client.close() -async def test_teams_join_by_code_error_400(): +def test_teams_join_by_code_error_400(): ec = _error_client(400) - with pytest.raises(ApiError) as exc_info: - await ec.v1.teams.join_by_code({}) - assert exc_info.value.status == 400 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.teams.join_by_code({}) + assert exc_info.value.status == 400 + finally: + ec.close() -async def test_teams_join_by_code_error_401(): +def test_teams_join_by_code_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.teams.join_by_code({}) - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.teams.join_by_code({}) + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_teams_join_by_code_error_404(): +def test_teams_join_by_code_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.teams.join_by_code({}) - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.teams.join_by_code({}) + assert exc_info.value.status == 404 + finally: + ec.close() -async def test_teams_join_by_code_error_429(): +def test_teams_join_by_code_error_429(): ec = _error_client(429) - with pytest.raises(ApiError) as exc_info: - await ec.v1.teams.join_by_code({}) - assert exc_info.value.status == 429 - - -async def test_teams_delete_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.teams.join_by_code({}) + assert exc_info.value.status == 429 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_teams_join_by_code_success(): + client = _async_client() + try: + result = await client.v1.teams.join_by_code({}) + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_teams_join_by_code_error_400(): + ec = _async_error_client(400) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.teams.join_by_code({}) + assert exc_info.value.status == 400 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_teams_join_by_code_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.teams.join_by_code({}) + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_teams_join_by_code_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.teams.join_by_code({}) + assert exc_info.value.status == 404 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_teams_join_by_code_error_429(): + ec = _async_error_client(429) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.teams.join_by_code({}) + assert exc_info.value.status == 429 + finally: + await ec.close() + + +def test_teams_delete_success(): client = _client() - result = await client.v1.teams.delete("test-value") - assert result is None + try: + result = client.v1.teams.delete("test-value") + assert result is None + finally: + client.close() -async def test_teams_delete_error_401(): +def test_teams_delete_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.teams.delete("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.teams.delete("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_teams_delete_error_403(): +def test_teams_delete_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.teams.delete("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.teams.delete("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_teams_delete_error_404(): +def test_teams_delete_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.teams.delete("test-value") - assert exc_info.value.status == 404 - - -async def test_teams_get_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.teams.delete("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_teams_delete_success(): + client = _async_client() + try: + result = await client.v1.teams.delete("test-value") + assert result is None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_teams_delete_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.teams.delete("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_teams_delete_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.teams.delete("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_teams_delete_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.teams.delete("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +def test_teams_get_success(): client = _client() - result = await client.v1.teams.get("test-value") - assert result is not None + try: + result = client.v1.teams.get("test-value") + assert result is not None + finally: + client.close() -async def test_teams_get_error_401(): +def test_teams_get_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.teams.get("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.teams.get("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_teams_get_error_403(): +def test_teams_get_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.teams.get("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.teams.get("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_teams_get_error_404(): +def test_teams_get_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.teams.get("test-value") - assert exc_info.value.status == 404 - - -async def test_teams_update_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.teams.get("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_teams_get_success(): + client = _async_client() + try: + result = await client.v1.teams.get("test-value") + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_teams_get_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.teams.get("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_teams_get_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.teams.get("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_teams_get_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.teams.get("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +def test_teams_update_success(): client = _client() - result = await client.v1.teams.update("test-value", {}) - assert result is not None + try: + result = client.v1.teams.update("test-value", {}) + assert result is not None + finally: + client.close() -async def test_teams_update_error_401(): +def test_teams_update_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.teams.update("test-value", {}) - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.teams.update("test-value", {}) + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_teams_update_error_403(): +def test_teams_update_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.teams.update("test-value", {}) - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.teams.update("test-value", {}) + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_teams_update_error_404(): +def test_teams_update_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.teams.update("test-value", {}) - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.teams.update("test-value", {}) + assert exc_info.value.status == 404 + finally: + ec.close() -async def test_teams_update_error_422(): +def test_teams_update_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.teams.update("test-value", {}) - assert exc_info.value.status == 422 - - -async def test_teams_invite_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.teams.update("test-value", {}) + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_teams_update_success(): + client = _async_client() + try: + result = await client.v1.teams.update("test-value", {}) + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_teams_update_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.teams.update("test-value", {}) + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_teams_update_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.teams.update("test-value", {}) + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_teams_update_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.teams.update("test-value", {}) + assert exc_info.value.status == 404 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_teams_update_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.teams.update("test-value", {}) + assert exc_info.value.status == 422 + finally: + await ec.close() + + +def test_teams_invite_success(): client = _client() - result = await client.v1.teams.invite("test-value") - assert result is not None + try: + result = client.v1.teams.invite("test-value") + assert result is not None + finally: + client.close() -async def test_teams_invite_error_401(): +def test_teams_invite_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.teams.invite("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.teams.invite("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_teams_invite_error_403(): +def test_teams_invite_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.teams.invite("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.teams.invite("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_teams_invite_error_404(): +def test_teams_invite_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.teams.invite("test-value") - assert exc_info.value.status == 404 - - -async def test_teams_invites_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.teams.invite("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_teams_invite_success(): + client = _async_client() + try: + result = await client.v1.teams.invite("test-value") + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_teams_invite_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.teams.invite("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_teams_invite_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.teams.invite("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_teams_invite_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.teams.invite("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +def test_teams_invites_success(): client = _client() - result = await client.v1.teams.invites("test-value") - assert result is not None + try: + result = client.v1.teams.invites("test-value") + assert result is not None + finally: + client.close() -async def test_teams_invites_error_401(): +def test_teams_invites_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.teams.invites("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.teams.invites("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_teams_invites_error_404(): +def test_teams_invites_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.teams.invites("test-value") - assert exc_info.value.status == 404 - - -async def test_teams_join_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.teams.invites("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_teams_invites_success(): + client = _async_client() + try: + result = await client.v1.teams.invites("test-value") + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_teams_invites_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.teams.invites("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_teams_invites_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.teams.invites("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +def test_teams_join_success(): client = _client() - result = await client.v1.teams.join("test-value", {}) - assert result is None + try: + result = client.v1.teams.join("test-value", {}) + assert result is None + finally: + client.close() -async def test_teams_join_error_400(): +def test_teams_join_error_400(): ec = _error_client(400) - with pytest.raises(ApiError) as exc_info: - await ec.v1.teams.join("test-value", {}) - assert exc_info.value.status == 400 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.teams.join("test-value", {}) + assert exc_info.value.status == 400 + finally: + ec.close() -async def test_teams_join_error_401(): +def test_teams_join_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.teams.join("test-value", {}) - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.teams.join("test-value", {}) + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_teams_join_error_403(): +def test_teams_join_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.teams.join("test-value", {}) - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.teams.join("test-value", {}) + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_teams_join_error_404(): +def test_teams_join_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.teams.join("test-value", {}) - assert exc_info.value.status == 404 - - -async def test_teams_leave_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.teams.join("test-value", {}) + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_teams_join_success(): + client = _async_client() + try: + result = await client.v1.teams.join("test-value", {}) + assert result is None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_teams_join_error_400(): + ec = _async_error_client(400) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.teams.join("test-value", {}) + assert exc_info.value.status == 400 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_teams_join_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.teams.join("test-value", {}) + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_teams_join_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.teams.join("test-value", {}) + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_teams_join_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.teams.join("test-value", {}) + assert exc_info.value.status == 404 + finally: + await ec.close() + + +def test_teams_leave_success(): client = _client() - result = await client.v1.teams.leave("test-value") - assert result is None + try: + result = client.v1.teams.leave("test-value") + assert result is None + finally: + client.close() -async def test_teams_leave_error_401(): +def test_teams_leave_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.teams.leave("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.teams.leave("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_teams_leave_error_403(): +def test_teams_leave_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.teams.leave("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.teams.leave("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_teams_leave_error_404(): +def test_teams_leave_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.teams.leave("test-value") - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.teams.leave("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() -async def test_teams_leave_error_422(): +def test_teams_leave_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.teams.leave("test-value") - assert exc_info.value.status == 422 - - -async def test_teams_artifacts_list_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.teams.leave("test-value") + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_teams_leave_success(): + client = _async_client() + try: + result = await client.v1.teams.leave("test-value") + assert result is None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_teams_leave_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.teams.leave("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_teams_leave_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.teams.leave("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_teams_leave_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.teams.leave("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_teams_leave_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.teams.leave("test-value") + assert exc_info.value.status == 422 + finally: + await ec.close() + + +def test_teams_artifacts_list_success(): client = _client() - result = await client.v1.teams.artifacts.list("test-value") - assert result is not None - assert "data" in result - assert isinstance(result["data"], list) + try: + result = client.v1.teams.artifacts.list("test-value") + assert result is not None + assert "data" in result + assert isinstance(result["data"], list) + finally: + client.close() -async def test_teams_artifacts_list_error_401(): +def test_teams_artifacts_list_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.teams.artifacts.list("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.teams.artifacts.list("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_teams_artifacts_list_error_404(): +def test_teams_artifacts_list_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.teams.artifacts.list("test-value") - assert exc_info.value.status == 404 - - -async def test_teams_artifacts_create_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.teams.artifacts.list("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_teams_artifacts_list_success(): + client = _async_client() + try: + result = await client.v1.teams.artifacts.list("test-value") + assert result is not None + assert "data" in result + assert isinstance(result["data"], list) + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_teams_artifacts_list_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.teams.artifacts.list("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_teams_artifacts_list_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.teams.artifacts.list("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +def test_teams_artifacts_create_success(): client = _client() - result = await client.v1.teams.artifacts.create("test-value", {"artifact": {}}) - assert result is not None + try: + result = client.v1.teams.artifacts.create("test-value", {"artifact": {}}) + assert result is not None + finally: + client.close() -async def test_teams_artifacts_create_error_401(): +def test_teams_artifacts_create_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.teams.artifacts.create("test-value", {"artifact": {}}) - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.teams.artifacts.create("test-value", {"artifact": {}}) + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_teams_artifacts_create_error_403(): +def test_teams_artifacts_create_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.teams.artifacts.create("test-value", {"artifact": {}}) - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.teams.artifacts.create("test-value", {"artifact": {}}) + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_teams_artifacts_create_error_422(): +def test_teams_artifacts_create_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.teams.artifacts.create("test-value", {"artifact": {}}) - assert exc_info.value.status == 422 - - -async def test_teams_custom_objects_list_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.teams.artifacts.create("test-value", {"artifact": {}}) + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_teams_artifacts_create_success(): + client = _async_client() + try: + result = await client.v1.teams.artifacts.create("test-value", {"artifact": {}}) + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_teams_artifacts_create_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.teams.artifacts.create("test-value", {"artifact": {}}) + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_teams_artifacts_create_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.teams.artifacts.create("test-value", {"artifact": {}}) + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_teams_artifacts_create_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.teams.artifacts.create("test-value", {"artifact": {}}) + assert exc_info.value.status == 422 + finally: + await ec.close() + + +def test_teams_custom_objects_list_success(): client = _client() - result = await client.v1.teams.custom_objects.list("test-value", type="test") - assert result is not None - assert "data" in result - assert isinstance(result["data"], list) + try: + result = client.v1.teams.custom_objects.list("test-value", type="test") + assert result is not None + assert "data" in result + assert isinstance(result["data"], list) + finally: + client.close() -async def test_teams_custom_objects_list_error_401(): +def test_teams_custom_objects_list_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.teams.custom_objects.list("test-value", type="test") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.teams.custom_objects.list("test-value", type="test") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_teams_custom_objects_list_error_404(): +def test_teams_custom_objects_list_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.teams.custom_objects.list("test-value", type="test") - assert exc_info.value.status == 404 - - -async def test_teams_custom_objects_create_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.teams.custom_objects.list("test-value", type="test") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_teams_custom_objects_list_success(): + client = _async_client() + try: + result = await client.v1.teams.custom_objects.list("test-value", type="test") + assert result is not None + assert "data" in result + assert isinstance(result["data"], list) + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_teams_custom_objects_list_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.teams.custom_objects.list("test-value", type="test") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_teams_custom_objects_list_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.teams.custom_objects.list("test-value", type="test") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +def test_teams_custom_objects_create_success(): client = _client() - result = await client.v1.teams.custom_objects.create( - "test-value", {"fields": {}, "type": "test"} - ) - assert result is not None + try: + result = client.v1.teams.custom_objects.create("test-value", {"fields": {}, "type": "test"}) + assert result is not None + finally: + client.close() -async def test_teams_custom_objects_create_error_401(): +def test_teams_custom_objects_create_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.teams.custom_objects.create("test-value", {"fields": {}, "type": "test"}) - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.teams.custom_objects.create("test-value", {"fields": {}, "type": "test"}) + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_teams_custom_objects_create_error_404(): +def test_teams_custom_objects_create_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.teams.custom_objects.create("test-value", {"fields": {}, "type": "test"}) - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.teams.custom_objects.create("test-value", {"fields": {}, "type": "test"}) + assert exc_info.value.status == 404 + finally: + ec.close() -async def test_teams_custom_objects_create_error_422(): +def test_teams_custom_objects_create_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.teams.custom_objects.create("test-value", {"fields": {}, "type": "test"}) - assert exc_info.value.status == 422 - - -async def test_teams_members_remove_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.teams.custom_objects.create("test-value", {"fields": {}, "type": "test"}) + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_teams_custom_objects_create_success(): + client = _async_client() + try: + result = await client.v1.teams.custom_objects.create( + "test-value", {"fields": {}, "type": "test"} + ) + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_teams_custom_objects_create_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.teams.custom_objects.create("test-value", {"fields": {}, "type": "test"}) + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_teams_custom_objects_create_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.teams.custom_objects.create("test-value", {"fields": {}, "type": "test"}) + assert exc_info.value.status == 404 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_teams_custom_objects_create_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.teams.custom_objects.create("test-value", {"fields": {}, "type": "test"}) + assert exc_info.value.status == 422 + finally: + await ec.close() + + +def test_teams_members_remove_success(): client = _client() - result = await client.v1.teams.members.remove("test-value") - assert result is None + try: + result = client.v1.teams.members.remove("test-value") + assert result is None + finally: + client.close() -async def test_teams_members_remove_error_400(): +def test_teams_members_remove_error_400(): ec = _error_client(400) - with pytest.raises(ApiError) as exc_info: - await ec.v1.teams.members.remove("test-value") - assert exc_info.value.status == 400 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.teams.members.remove("test-value") + assert exc_info.value.status == 400 + finally: + ec.close() -async def test_teams_members_remove_error_401(): +def test_teams_members_remove_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.teams.members.remove("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.teams.members.remove("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_teams_members_remove_error_403(): +def test_teams_members_remove_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.teams.members.remove("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.teams.members.remove("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_teams_members_remove_error_404(): +def test_teams_members_remove_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.teams.members.remove("test-value") - assert exc_info.value.status == 404 - - -async def test_teams_members_list_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.teams.members.remove("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_teams_members_remove_success(): + client = _async_client() + try: + result = await client.v1.teams.members.remove("test-value") + assert result is None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_teams_members_remove_error_400(): + ec = _async_error_client(400) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.teams.members.remove("test-value") + assert exc_info.value.status == 400 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_teams_members_remove_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.teams.members.remove("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_teams_members_remove_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.teams.members.remove("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_teams_members_remove_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.teams.members.remove("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +def test_teams_members_list_success(): client = _client() - result = await client.v1.teams.members.list("test-value") - assert result is not None - assert "data" in result - assert isinstance(result["data"], list) + try: + result = client.v1.teams.members.list("test-value") + assert result is not None + assert "data" in result + assert isinstance(result["data"], list) + finally: + client.close() -async def test_teams_members_list_error_401(): +def test_teams_members_list_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.teams.members.list("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.teams.members.list("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_teams_members_list_error_404(): +def test_teams_members_list_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.teams.members.list("test-value") - assert exc_info.value.status == 404 - - -async def test_teams_members_create_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.teams.members.list("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_teams_members_list_success(): + client = _async_client() + try: + result = await client.v1.teams.members.list("test-value") + assert result is not None + assert "data" in result + assert isinstance(result["data"], list) + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_teams_members_list_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.teams.members.list("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_teams_members_list_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.teams.members.list("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +def test_teams_members_create_success(): client = _client() - result = await client.v1.teams.members.create("test-value", {}) - assert result is not None + try: + result = client.v1.teams.members.create("test-value", {}) + assert result is not None + finally: + client.close() -async def test_teams_members_create_error_401(): +def test_teams_members_create_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.teams.members.create("test-value", {}) - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.teams.members.create("test-value", {}) + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_teams_members_create_error_404(): +def test_teams_members_create_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.teams.members.create("test-value", {}) - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.teams.members.create("test-value", {}) + assert exc_info.value.status == 404 + finally: + ec.close() -async def test_teams_members_create_error_422(): +def test_teams_members_create_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.teams.members.create("test-value", {}) - assert exc_info.value.status == 422 - - -async def test_teams_members_update_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.teams.members.create("test-value", {}) + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_teams_members_create_success(): + client = _async_client() + try: + result = await client.v1.teams.members.create("test-value", {}) + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_teams_members_create_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.teams.members.create("test-value", {}) + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_teams_members_create_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.teams.members.create("test-value", {}) + assert exc_info.value.status == 404 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_teams_members_create_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.teams.members.create("test-value", {}) + assert exc_info.value.status == 422 + finally: + await ec.close() + + +def test_teams_members_update_success(): client = _client() - result = await client.v1.teams.members.update("test-value", "test-value", {"role": "user"}) - assert result is not None + try: + result = client.v1.teams.members.update("test-value", "test-value", {"role": "user"}) + assert result is not None + finally: + client.close() -async def test_teams_members_update_error_401(): +def test_teams_members_update_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.teams.members.update("test-value", "test-value", {"role": "user"}) - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.teams.members.update("test-value", "test-value", {"role": "user"}) + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_teams_members_update_error_403(): +def test_teams_members_update_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.teams.members.update("test-value", "test-value", {"role": "user"}) - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.teams.members.update("test-value", "test-value", {"role": "user"}) + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_teams_members_update_error_404(): +def test_teams_members_update_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.teams.members.update("test-value", "test-value", {"role": "user"}) - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.teams.members.update("test-value", "test-value", {"role": "user"}) + assert exc_info.value.status == 404 + finally: + ec.close() -async def test_teams_members_update_error_409(): +def test_teams_members_update_error_409(): ec = _error_client(409) - with pytest.raises(ApiError) as exc_info: - await ec.v1.teams.members.update("test-value", "test-value", {"role": "user"}) - assert exc_info.value.status == 409 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.teams.members.update("test-value", "test-value", {"role": "user"}) + assert exc_info.value.status == 409 + finally: + ec.close() -async def test_teams_members_update_error_422(): +def test_teams_members_update_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.teams.members.update("test-value", "test-value", {"role": "user"}) - assert exc_info.value.status == 422 - - -async def test_teams_threads_list_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.teams.members.update("test-value", "test-value", {"role": "user"}) + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_teams_members_update_success(): + client = _async_client() + try: + result = await client.v1.teams.members.update("test-value", "test-value", {"role": "user"}) + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_teams_members_update_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.teams.members.update("test-value", "test-value", {"role": "user"}) + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_teams_members_update_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.teams.members.update("test-value", "test-value", {"role": "user"}) + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_teams_members_update_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.teams.members.update("test-value", "test-value", {"role": "user"}) + assert exc_info.value.status == 404 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_teams_members_update_error_409(): + ec = _async_error_client(409) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.teams.members.update("test-value", "test-value", {"role": "user"}) + assert exc_info.value.status == 409 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_teams_members_update_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.teams.members.update("test-value", "test-value", {"role": "user"}) + assert exc_info.value.status == 422 + finally: + await ec.close() + + +def test_teams_threads_list_success(): client = _client() - result = await client.v1.teams.threads.list("test-value") - assert result is not None - assert "data" in result - assert isinstance(result["data"], list) + try: + result = client.v1.teams.threads.list("test-value") + assert result is not None + assert "data" in result + assert isinstance(result["data"], list) + finally: + client.close() -async def test_teams_threads_list_error_401(): +def test_teams_threads_list_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.teams.threads.list("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.teams.threads.list("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_teams_threads_list_error_404(): +def test_teams_threads_list_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.teams.threads.list("test-value") - assert exc_info.value.status == 404 - - -async def test_teams_threads_create_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.teams.threads.list("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_teams_threads_list_success(): + client = _async_client() + try: + result = await client.v1.teams.threads.list("test-value") + assert result is not None + assert "data" in result + assert isinstance(result["data"], list) + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_teams_threads_list_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.teams.threads.list("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_teams_threads_list_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.teams.threads.list("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +def test_teams_threads_create_success(): client = _client() - result = await client.v1.teams.threads.create("test-value", {"thread": {}}) - assert result is not None + try: + result = client.v1.teams.threads.create("test-value", {"thread": {}}) + assert result is not None + finally: + client.close() -async def test_teams_threads_create_error_401(): +def test_teams_threads_create_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.teams.threads.create("test-value", {"thread": {}}) - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.teams.threads.create("test-value", {"thread": {}}) + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_teams_threads_create_error_404(): +def test_teams_threads_create_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.teams.threads.create("test-value", {"thread": {}}) - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.teams.threads.create("test-value", {"thread": {}}) + assert exc_info.value.status == 404 + finally: + ec.close() -async def test_teams_threads_create_error_422(): +def test_teams_threads_create_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.teams.threads.create("test-value", {"thread": {}}) - assert exc_info.value.status == 422 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.teams.threads.create("test-value", {"thread": {}}) + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_teams_threads_create_success(): + client = _async_client() + try: + result = await client.v1.teams.threads.create("test-value", {"thread": {}}) + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_teams_threads_create_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.teams.threads.create("test-value", {"thread": {}}) + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_teams_threads_create_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.teams.threads.create("test-value", {"thread": {}}) + assert exc_info.value.status == 404 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_teams_threads_create_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.teams.threads.create("test-value", {"thread": {}}) + assert exc_info.value.status == 422 + finally: + await ec.close() diff --git a/tests/contract/v1/test_thread_messages.py b/tests/contract/v1/test_thread_messages.py index f96de26..38bace9 100644 --- a/tests/contract/v1/test_thread_messages.py +++ b/tests/contract/v1/test_thread_messages.py @@ -1,10 +1,10 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: 1d9e830fc739 +# Content hash: a0dcf7fe4db8 import pytest -from archastro.platform import PlatformClient +from archastro.platform import AsyncPlatformClient, PlatformClient from archastro.platform.runtime.http_client import ApiError PRISM_URL = "http://127.0.0.1:4040" @@ -26,171 +26,534 @@ def _error_client(code: int) -> PlatformClient: ) -async def test_thread_messages_delete_success(): +def _async_client() -> AsyncPlatformClient: + return AsyncPlatformClient( + base_url=PRISM_URL, + default_headers={"x-archastro-api-key": "pk_test-key"}, + access_token="test-token", + ) + + +def _async_error_client(code: int) -> AsyncPlatformClient: + return AsyncPlatformClient( + base_url=PRISM_URL, + default_headers={"x-archastro-api-key": "pk_test-key", "Prefer": f"code={code}"}, + access_token="test-token", + ) + + +def test_thread_messages_delete_success(): client = _client() - result = await client.v1.thread_messages.delete("test-value") - assert result is None + try: + result = client.v1.thread_messages.delete("test-value") + assert result is None + finally: + client.close() -async def test_thread_messages_delete_error_401(): +def test_thread_messages_delete_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.thread_messages.delete("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.thread_messages.delete("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_thread_messages_delete_error_403(): +def test_thread_messages_delete_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.thread_messages.delete("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.thread_messages.delete("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_thread_messages_delete_error_404(): +def test_thread_messages_delete_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.thread_messages.delete("test-value") - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.thread_messages.delete("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() -async def test_thread_messages_delete_error_422(): +def test_thread_messages_delete_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.thread_messages.delete("test-value") - assert exc_info.value.status == 422 - - -async def test_thread_messages_replace_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.thread_messages.delete("test-value") + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_thread_messages_delete_success(): + client = _async_client() + try: + result = await client.v1.thread_messages.delete("test-value") + assert result is None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_thread_messages_delete_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.thread_messages.delete("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_thread_messages_delete_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.thread_messages.delete("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_thread_messages_delete_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.thread_messages.delete("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_thread_messages_delete_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.thread_messages.delete("test-value") + assert exc_info.value.status == 422 + finally: + await ec.close() + + +def test_thread_messages_replace_success(): client = _client() - result = await client.v1.thread_messages.replace("test-value", {}) - assert result is not None + try: + result = client.v1.thread_messages.replace("test-value", {}) + assert result is not None + finally: + client.close() -async def test_thread_messages_replace_error_401(): +def test_thread_messages_replace_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.thread_messages.replace("test-value", {}) - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.thread_messages.replace("test-value", {}) + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_thread_messages_replace_error_403(): +def test_thread_messages_replace_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.thread_messages.replace("test-value", {}) - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.thread_messages.replace("test-value", {}) + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_thread_messages_replace_error_404(): +def test_thread_messages_replace_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.thread_messages.replace("test-value", {}) - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.thread_messages.replace("test-value", {}) + assert exc_info.value.status == 404 + finally: + ec.close() -async def test_thread_messages_replace_error_422(): +def test_thread_messages_replace_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.thread_messages.replace("test-value", {}) - assert exc_info.value.status == 422 - - -async def test_thread_messages_replies_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.thread_messages.replace("test-value", {}) + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_thread_messages_replace_success(): + client = _async_client() + try: + result = await client.v1.thread_messages.replace("test-value", {}) + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_thread_messages_replace_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.thread_messages.replace("test-value", {}) + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_thread_messages_replace_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.thread_messages.replace("test-value", {}) + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_thread_messages_replace_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.thread_messages.replace("test-value", {}) + assert exc_info.value.status == 404 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_thread_messages_replace_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.thread_messages.replace("test-value", {}) + assert exc_info.value.status == 422 + finally: + await ec.close() + + +def test_thread_messages_replies_success(): client = _client() - result = await client.v1.thread_messages.replies("test-value") - assert result is not None + try: + result = client.v1.thread_messages.replies("test-value") + assert result is not None + finally: + client.close() -async def test_thread_messages_replies_error_401(): +def test_thread_messages_replies_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.thread_messages.replies("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.thread_messages.replies("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_thread_messages_replies_error_403(): +def test_thread_messages_replies_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.thread_messages.replies("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.thread_messages.replies("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_thread_messages_replies_error_404(): +def test_thread_messages_replies_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.thread_messages.replies("test-value") - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.thread_messages.replies("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() -async def test_thread_messages_replies_error_422(): +def test_thread_messages_replies_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.thread_messages.replies("test-value") - assert exc_info.value.status == 422 - - -async def test_thread_messages_reactions_remove_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.thread_messages.replies("test-value") + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_thread_messages_replies_success(): + client = _async_client() + try: + result = await client.v1.thread_messages.replies("test-value") + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_thread_messages_replies_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.thread_messages.replies("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_thread_messages_replies_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.thread_messages.replies("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_thread_messages_replies_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.thread_messages.replies("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_thread_messages_replies_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.thread_messages.replies("test-value") + assert exc_info.value.status == 422 + finally: + await ec.close() + + +def test_thread_messages_reactions_remove_success(): client = _client() - result = await client.v1.thread_messages.reactions.remove("test-value") - assert result is None + try: + result = client.v1.thread_messages.reactions.remove("test-value") + assert result is None + finally: + client.close() -async def test_thread_messages_reactions_remove_error_401(): +def test_thread_messages_reactions_remove_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.thread_messages.reactions.remove("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.thread_messages.reactions.remove("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_thread_messages_reactions_remove_error_403(): +def test_thread_messages_reactions_remove_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.thread_messages.reactions.remove("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.thread_messages.reactions.remove("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_thread_messages_reactions_remove_error_404(): +def test_thread_messages_reactions_remove_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.thread_messages.reactions.remove("test-value") - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.thread_messages.reactions.remove("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() -async def test_thread_messages_reactions_remove_error_422(): +def test_thread_messages_reactions_remove_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.thread_messages.reactions.remove("test-value") - assert exc_info.value.status == 422 - - -async def test_thread_messages_reactions_create_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.thread_messages.reactions.remove("test-value") + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_thread_messages_reactions_remove_success(): + client = _async_client() + try: + result = await client.v1.thread_messages.reactions.remove("test-value") + assert result is None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_thread_messages_reactions_remove_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.thread_messages.reactions.remove("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_thread_messages_reactions_remove_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.thread_messages.reactions.remove("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_thread_messages_reactions_remove_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.thread_messages.reactions.remove("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_thread_messages_reactions_remove_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.thread_messages.reactions.remove("test-value") + assert exc_info.value.status == 422 + finally: + await ec.close() + + +def test_thread_messages_reactions_create_success(): client = _client() - result = await client.v1.thread_messages.reactions.create("test-value", {"emoji": "test-value"}) - assert result is not None + try: + result = client.v1.thread_messages.reactions.create("test-value", {"emoji": "test-value"}) + assert result is not None + finally: + client.close() -async def test_thread_messages_reactions_create_error_401(): +def test_thread_messages_reactions_create_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.thread_messages.reactions.create("test-value", {"emoji": "test-value"}) - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.thread_messages.reactions.create("test-value", {"emoji": "test-value"}) + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_thread_messages_reactions_create_error_403(): +def test_thread_messages_reactions_create_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.thread_messages.reactions.create("test-value", {"emoji": "test-value"}) - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.thread_messages.reactions.create("test-value", {"emoji": "test-value"}) + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_thread_messages_reactions_create_error_404(): +def test_thread_messages_reactions_create_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.thread_messages.reactions.create("test-value", {"emoji": "test-value"}) - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.thread_messages.reactions.create("test-value", {"emoji": "test-value"}) + assert exc_info.value.status == 404 + finally: + ec.close() -async def test_thread_messages_reactions_create_error_422(): +def test_thread_messages_reactions_create_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.thread_messages.reactions.create("test-value", {"emoji": "test-value"}) - assert exc_info.value.status == 422 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.thread_messages.reactions.create("test-value", {"emoji": "test-value"}) + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_thread_messages_reactions_create_success(): + client = _async_client() + try: + result = await client.v1.thread_messages.reactions.create( + "test-value", {"emoji": "test-value"} + ) + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_thread_messages_reactions_create_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.thread_messages.reactions.create("test-value", {"emoji": "test-value"}) + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_thread_messages_reactions_create_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.thread_messages.reactions.create("test-value", {"emoji": "test-value"}) + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_thread_messages_reactions_create_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.thread_messages.reactions.create("test-value", {"emoji": "test-value"}) + assert exc_info.value.status == 404 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_thread_messages_reactions_create_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.thread_messages.reactions.create("test-value", {"emoji": "test-value"}) + assert exc_info.value.status == 422 + finally: + await ec.close() diff --git a/tests/contract/v1/test_threads.py b/tests/contract/v1/test_threads.py index b5f80be..21080ac 100644 --- a/tests/contract/v1/test_threads.py +++ b/tests/contract/v1/test_threads.py @@ -1,10 +1,10 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: c11071041bcb +# Content hash: 7f4dd15e5559 import pytest -from archastro.platform import PlatformClient +from archastro.platform import AsyncPlatformClient, PlatformClient from archastro.platform.runtime.http_client import ApiError PRISM_URL = "http://127.0.0.1:4040" @@ -26,225 +26,629 @@ def _error_client(code: int) -> PlatformClient: ) -async def test_threads_delete_success(): +def _async_client() -> AsyncPlatformClient: + return AsyncPlatformClient( + base_url=PRISM_URL, + default_headers={"x-archastro-api-key": "pk_test-key"}, + access_token="test-token", + ) + + +def _async_error_client(code: int) -> AsyncPlatformClient: + return AsyncPlatformClient( + base_url=PRISM_URL, + default_headers={"x-archastro-api-key": "pk_test-key", "Prefer": f"code={code}"}, + access_token="test-token", + ) + + +def test_threads_delete_success(): client = _client() - result = await client.v1.threads.delete("test-value") - assert result is None + try: + result = client.v1.threads.delete("test-value") + assert result is None + finally: + client.close() -async def test_threads_delete_error_401(): +def test_threads_delete_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.threads.delete("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.threads.delete("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_threads_delete_error_403(): +def test_threads_delete_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.threads.delete("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.threads.delete("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_threads_delete_error_404(): +def test_threads_delete_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.threads.delete("test-value") - assert exc_info.value.status == 404 - - -async def test_threads_get_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.threads.delete("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_threads_delete_success(): + client = _async_client() + try: + result = await client.v1.threads.delete("test-value") + assert result is None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_threads_delete_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.threads.delete("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_threads_delete_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.threads.delete("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_threads_delete_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.threads.delete("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +def test_threads_get_success(): client = _client() - result = await client.v1.threads.get("test-value") - assert result is not None + try: + result = client.v1.threads.get("test-value") + assert result is not None + finally: + client.close() -async def test_threads_get_error_401(): +def test_threads_get_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.threads.get("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.threads.get("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_threads_get_error_403(): +def test_threads_get_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.threads.get("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.threads.get("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_threads_get_error_404(): +def test_threads_get_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.threads.get("test-value") - assert exc_info.value.status == 404 - - -async def test_threads_replace_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.threads.get("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_threads_get_success(): + client = _async_client() + try: + result = await client.v1.threads.get("test-value") + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_threads_get_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.threads.get("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_threads_get_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.threads.get("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_threads_get_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.threads.get("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +def test_threads_replace_success(): client = _client() - result = await client.v1.threads.replace("test-value", {}) - assert result is not None + try: + result = client.v1.threads.replace("test-value", {}) + assert result is not None + finally: + client.close() -async def test_threads_replace_error_401(): +def test_threads_replace_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.threads.replace("test-value", {}) - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.threads.replace("test-value", {}) + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_threads_replace_error_403(): +def test_threads_replace_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.threads.replace("test-value", {}) - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.threads.replace("test-value", {}) + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_threads_replace_error_404(): +def test_threads_replace_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.threads.replace("test-value", {}) - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.threads.replace("test-value", {}) + assert exc_info.value.status == 404 + finally: + ec.close() -async def test_threads_replace_error_422(): +def test_threads_replace_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.threads.replace("test-value", {}) - assert exc_info.value.status == 422 - - -async def test_threads_agents_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.threads.replace("test-value", {}) + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_threads_replace_success(): + client = _async_client() + try: + result = await client.v1.threads.replace("test-value", {}) + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_threads_replace_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.threads.replace("test-value", {}) + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_threads_replace_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.threads.replace("test-value", {}) + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_threads_replace_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.threads.replace("test-value", {}) + assert exc_info.value.status == 404 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_threads_replace_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.threads.replace("test-value", {}) + assert exc_info.value.status == 422 + finally: + await ec.close() + + +def test_threads_agents_success(): client = _client() - result = await client.v1.threads.agents("test-value") - assert result is not None - assert "data" in result - assert isinstance(result["data"], list) + try: + result = client.v1.threads.agents("test-value") + assert result is not None + assert "data" in result + assert isinstance(result["data"], list) + finally: + client.close() -async def test_threads_agents_error_401(): +def test_threads_agents_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.threads.agents("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.threads.agents("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_threads_agents_error_403(): +def test_threads_agents_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.threads.agents("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.threads.agents("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_threads_agents_error_404(): +def test_threads_agents_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.threads.agents("test-value") - assert exc_info.value.status == 404 - - -async def test_threads_artifacts_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.threads.agents("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_threads_agents_success(): + client = _async_client() + try: + result = await client.v1.threads.agents("test-value") + assert result is not None + assert "data" in result + assert isinstance(result["data"], list) + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_threads_agents_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.threads.agents("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_threads_agents_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.threads.agents("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_threads_agents_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.threads.agents("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +def test_threads_artifacts_success(): client = _client() - result = await client.v1.threads.artifacts("test-value") - assert result is not None - assert "data" in result - assert isinstance(result["data"], list) + try: + result = client.v1.threads.artifacts("test-value") + assert result is not None + assert "data" in result + assert isinstance(result["data"], list) + finally: + client.close() -async def test_threads_artifacts_error_401(): +def test_threads_artifacts_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.threads.artifacts("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.threads.artifacts("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_threads_artifacts_error_403(): +def test_threads_artifacts_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.threads.artifacts("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.threads.artifacts("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_threads_artifacts_error_404(): +def test_threads_artifacts_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.threads.artifacts("test-value") - assert exc_info.value.status == 404 - - -async def test_threads_mark_read_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.threads.artifacts("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_threads_artifacts_success(): + client = _async_client() + try: + result = await client.v1.threads.artifacts("test-value") + assert result is not None + assert "data" in result + assert isinstance(result["data"], list) + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_threads_artifacts_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.threads.artifacts("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_threads_artifacts_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.threads.artifacts("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_threads_artifacts_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.threads.artifacts("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +def test_threads_mark_read_success(): client = _client() - result = await client.v1.threads.mark_read("test-value", {}) - assert result is None + try: + result = client.v1.threads.mark_read("test-value", {}) + assert result is None + finally: + client.close() -async def test_threads_mark_read_error_401(): +def test_threads_mark_read_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.threads.mark_read("test-value", {}) - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.threads.mark_read("test-value", {}) + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_threads_mark_read_error_404(): +def test_threads_mark_read_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.threads.mark_read("test-value", {}) - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.threads.mark_read("test-value", {}) + assert exc_info.value.status == 404 + finally: + ec.close() -async def test_threads_mark_read_error_422(): +def test_threads_mark_read_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.threads.mark_read("test-value", {}) - assert exc_info.value.status == 422 - - -async def test_threads_messages_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.threads.mark_read("test-value", {}) + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_threads_mark_read_success(): + client = _async_client() + try: + result = await client.v1.threads.mark_read("test-value", {}) + assert result is None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_threads_mark_read_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.threads.mark_read("test-value", {}) + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_threads_mark_read_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.threads.mark_read("test-value", {}) + assert exc_info.value.status == 404 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_threads_mark_read_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.threads.mark_read("test-value", {}) + assert exc_info.value.status == 422 + finally: + await ec.close() + + +def test_threads_messages_success(): client = _client() - result = await client.v1.threads.messages("test-value") - assert result is not None + try: + result = client.v1.threads.messages("test-value") + assert result is not None + finally: + client.close() -async def test_threads_messages_error_401(): +def test_threads_messages_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.threads.messages("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.threads.messages("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_threads_messages_error_403(): +def test_threads_messages_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.threads.messages("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.threads.messages("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_threads_messages_error_404(): +def test_threads_messages_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.threads.messages("test-value") - assert exc_info.value.status == 404 - - -async def test_threads_picture_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.threads.messages("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_threads_messages_success(): + client = _async_client() + try: + result = await client.v1.threads.messages("test-value") + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_threads_messages_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.threads.messages("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_threads_messages_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.threads.messages("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_threads_messages_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.threads.messages("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +def test_threads_picture_success(): client = _client() - result = await client.v1.threads.picture( - "test-value", - { - "picture": { - "data": "test-value", - "filename": "test-value", - "mime_type": "application/json", - } - }, - ) - assert result is not None - - -async def test_threads_picture_error_401(): - ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.threads.picture( + try: + result = client.v1.threads.picture( "test-value", { "picture": { @@ -254,45 +658,92 @@ async def test_threads_picture_error_401(): } }, ) - assert exc_info.value.status == 401 + assert result is not None + finally: + client.close() -async def test_threads_picture_error_403(): +def test_threads_picture_error_401(): + ec = _error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.threads.picture( + "test-value", + { + "picture": { + "data": "test-value", + "filename": "test-value", + "mime_type": "application/json", + } + }, + ) + assert exc_info.value.status == 401 + finally: + ec.close() + + +def test_threads_picture_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.threads.picture( - "test-value", - { - "picture": { - "data": "test-value", - "filename": "test-value", - "mime_type": "application/json", - } - }, - ) - assert exc_info.value.status == 403 - - -async def test_threads_picture_error_404(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.threads.picture( + "test-value", + { + "picture": { + "data": "test-value", + "filename": "test-value", + "mime_type": "application/json", + } + }, + ) + assert exc_info.value.status == 403 + finally: + ec.close() + + +def test_threads_picture_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.threads.picture( - "test-value", - { - "picture": { - "data": "test-value", - "filename": "test-value", - "mime_type": "application/json", - } - }, - ) - assert exc_info.value.status == 404 - - -async def test_threads_picture_error_422(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.threads.picture( + "test-value", + { + "picture": { + "data": "test-value", + "filename": "test-value", + "mime_type": "application/json", + } + }, + ) + assert exc_info.value.status == 404 + finally: + ec.close() + + +def test_threads_picture_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.threads.picture( + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.threads.picture( + "test-value", + { + "picture": { + "data": "test-value", + "filename": "test-value", + "mime_type": "application/json", + } + }, + ) + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_threads_picture_success(): + client = _async_client() + try: + result = await client.v1.threads.picture( "test-value", { "picture": { @@ -302,204 +753,689 @@ async def test_threads_picture_error_422(): } }, ) - assert exc_info.value.status == 422 - - -async def test_threads_read_status_success(): + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_threads_picture_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.threads.picture( + "test-value", + { + "picture": { + "data": "test-value", + "filename": "test-value", + "mime_type": "application/json", + } + }, + ) + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_threads_picture_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.threads.picture( + "test-value", + { + "picture": { + "data": "test-value", + "filename": "test-value", + "mime_type": "application/json", + } + }, + ) + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_threads_picture_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.threads.picture( + "test-value", + { + "picture": { + "data": "test-value", + "filename": "test-value", + "mime_type": "application/json", + } + }, + ) + assert exc_info.value.status == 404 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_threads_picture_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.threads.picture( + "test-value", + { + "picture": { + "data": "test-value", + "filename": "test-value", + "mime_type": "application/json", + } + }, + ) + assert exc_info.value.status == 422 + finally: + await ec.close() + + +def test_threads_read_status_success(): client = _client() - result = await client.v1.threads.read_status("test-value") - assert result is not None + try: + result = client.v1.threads.read_status("test-value") + assert result is not None + finally: + client.close() -async def test_threads_read_status_error_401(): +def test_threads_read_status_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.threads.read_status("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.threads.read_status("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_threads_read_status_error_403(): +def test_threads_read_status_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.threads.read_status("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.threads.read_status("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_threads_read_status_error_404(): +def test_threads_read_status_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.threads.read_status("test-value") - assert exc_info.value.status == 404 - - -async def test_threads_search_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.threads.read_status("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_threads_read_status_success(): + client = _async_client() + try: + result = await client.v1.threads.read_status("test-value") + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_threads_read_status_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.threads.read_status("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_threads_read_status_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.threads.read_status("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_threads_read_status_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.threads.read_status("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +def test_threads_search_success(): client = _client() - result = await client.v1.threads.search("test-value", q="test-value") - assert result is not None - assert "data" in result - assert isinstance(result["data"], list) + try: + result = client.v1.threads.search("test-value", q="test-value") + assert result is not None + assert "data" in result + assert isinstance(result["data"], list) + finally: + client.close() -async def test_threads_search_error_401(): +def test_threads_search_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.threads.search("test-value", q="test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.threads.search("test-value", q="test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_threads_search_error_403(): +def test_threads_search_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.threads.search("test-value", q="test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.threads.search("test-value", q="test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_threads_search_error_404(): +def test_threads_search_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.threads.search("test-value", q="test-value") - assert exc_info.value.status == 404 - - -async def test_threads_members_remove_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.threads.search("test-value", q="test-value") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_threads_search_success(): + client = _async_client() + try: + result = await client.v1.threads.search("test-value", q="test-value") + assert result is not None + assert "data" in result + assert isinstance(result["data"], list) + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_threads_search_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.threads.search("test-value", q="test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_threads_search_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.threads.search("test-value", q="test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_threads_search_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.threads.search("test-value", q="test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +def test_threads_members_remove_success(): client = _client() - result = await client.v1.threads.members.remove("test-value") - assert result is None + try: + result = client.v1.threads.members.remove("test-value") + assert result is None + finally: + client.close() -async def test_threads_members_remove_error_401(): +def test_threads_members_remove_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.threads.members.remove("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.threads.members.remove("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_threads_members_remove_error_404(): +def test_threads_members_remove_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.threads.members.remove("test-value") - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.threads.members.remove("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() -async def test_threads_members_remove_error_422(): +def test_threads_members_remove_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.threads.members.remove("test-value") - assert exc_info.value.status == 422 - - -async def test_threads_members_list_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.threads.members.remove("test-value") + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_threads_members_remove_success(): + client = _async_client() + try: + result = await client.v1.threads.members.remove("test-value") + assert result is None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_threads_members_remove_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.threads.members.remove("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_threads_members_remove_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.threads.members.remove("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_threads_members_remove_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.threads.members.remove("test-value") + assert exc_info.value.status == 422 + finally: + await ec.close() + + +def test_threads_members_list_success(): client = _client() - result = await client.v1.threads.members.list("test-value") - assert result is not None - assert "data" in result - assert isinstance(result["data"], list) + try: + result = client.v1.threads.members.list("test-value") + assert result is not None + assert "data" in result + assert isinstance(result["data"], list) + finally: + client.close() -async def test_threads_members_list_error_401(): +def test_threads_members_list_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.threads.members.list("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.threads.members.list("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_threads_members_list_error_403(): +def test_threads_members_list_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.threads.members.list("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.threads.members.list("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_threads_members_list_error_404(): +def test_threads_members_list_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.threads.members.list("test-value") - assert exc_info.value.status == 404 - - -async def test_threads_members_create_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.threads.members.list("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_threads_members_list_success(): + client = _async_client() + try: + result = await client.v1.threads.members.list("test-value") + assert result is not None + assert "data" in result + assert isinstance(result["data"], list) + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_threads_members_list_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.threads.members.list("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_threads_members_list_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.threads.members.list("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_threads_members_list_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.threads.members.list("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +def test_threads_members_create_success(): client = _client() - result = await client.v1.threads.members.create("test-value", {"type": "test"}) - assert result is not None + try: + result = client.v1.threads.members.create("test-value", {"type": "test"}) + assert result is not None + finally: + client.close() -async def test_threads_members_create_error_401(): +def test_threads_members_create_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.threads.members.create("test-value", {"type": "test"}) - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.threads.members.create("test-value", {"type": "test"}) + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_threads_members_create_error_404(): +def test_threads_members_create_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.threads.members.create("test-value", {"type": "test"}) - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.threads.members.create("test-value", {"type": "test"}) + assert exc_info.value.status == 404 + finally: + ec.close() -async def test_threads_members_create_error_422(): +def test_threads_members_create_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.threads.members.create("test-value", {"type": "test"}) - assert exc_info.value.status == 422 - - -async def test_threads_settings_list_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.threads.members.create("test-value", {"type": "test"}) + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_threads_members_create_success(): + client = _async_client() + try: + result = await client.v1.threads.members.create("test-value", {"type": "test"}) + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_threads_members_create_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.threads.members.create("test-value", {"type": "test"}) + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_threads_members_create_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.threads.members.create("test-value", {"type": "test"}) + assert exc_info.value.status == 404 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_threads_members_create_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.threads.members.create("test-value", {"type": "test"}) + assert exc_info.value.status == 422 + finally: + await ec.close() + + +def test_threads_settings_list_success(): client = _client() - result = await client.v1.threads.settings.list("test-value") - assert result is not None + try: + result = client.v1.threads.settings.list("test-value") + assert result is not None + finally: + client.close() -async def test_threads_settings_list_error_401(): +def test_threads_settings_list_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.threads.settings.list("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.threads.settings.list("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_threads_settings_list_error_403(): +def test_threads_settings_list_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.threads.settings.list("test-value") - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.threads.settings.list("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_threads_settings_list_error_404(): +def test_threads_settings_list_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.threads.settings.list("test-value") - assert exc_info.value.status == 404 - - -async def test_threads_settings_replace_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.threads.settings.list("test-value") + assert exc_info.value.status == 404 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_threads_settings_list_success(): + client = _async_client() + try: + result = await client.v1.threads.settings.list("test-value") + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_threads_settings_list_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.threads.settings.list("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_threads_settings_list_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.threads.settings.list("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_threads_settings_list_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.threads.settings.list("test-value") + assert exc_info.value.status == 404 + finally: + await ec.close() + + +def test_threads_settings_replace_success(): client = _client() - result = await client.v1.threads.settings.replace("test-value", {"settings": {}}) - assert result is not None + try: + result = client.v1.threads.settings.replace("test-value", {"settings": {}}) + assert result is not None + finally: + client.close() -async def test_threads_settings_replace_error_401(): +def test_threads_settings_replace_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.threads.settings.replace("test-value", {"settings": {}}) - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.threads.settings.replace("test-value", {"settings": {}}) + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_threads_settings_replace_error_403(): +def test_threads_settings_replace_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.threads.settings.replace("test-value", {"settings": {}}) - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.threads.settings.replace("test-value", {"settings": {}}) + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_threads_settings_replace_error_404(): +def test_threads_settings_replace_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.threads.settings.replace("test-value", {"settings": {}}) - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.threads.settings.replace("test-value", {"settings": {}}) + assert exc_info.value.status == 404 + finally: + ec.close() -async def test_threads_settings_replace_error_422(): +def test_threads_settings_replace_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.threads.settings.replace("test-value", {"settings": {}}) - assert exc_info.value.status == 422 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.threads.settings.replace("test-value", {"settings": {}}) + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_threads_settings_replace_success(): + client = _async_client() + try: + result = await client.v1.threads.settings.replace("test-value", {"settings": {}}) + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_threads_settings_replace_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.threads.settings.replace("test-value", {"settings": {}}) + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_threads_settings_replace_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.threads.settings.replace("test-value", {"settings": {}}) + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_threads_settings_replace_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.threads.settings.replace("test-value", {"settings": {}}) + assert exc_info.value.status == 404 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_threads_settings_replace_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.threads.settings.replace("test-value", {"settings": {}}) + assert exc_info.value.status == 422 + finally: + await ec.close() diff --git a/tests/contract/v1/test_users.py b/tests/contract/v1/test_users.py index 1b4bc5d..780b562 100644 --- a/tests/contract/v1/test_users.py +++ b/tests/contract/v1/test_users.py @@ -1,10 +1,10 @@ # Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. # This file is auto-generated by @archastro/sdk-generator. Do not edit. -# Content hash: d908db9b9d4b +# Content hash: 3bd0d7654814 import pytest -from archastro.platform import PlatformClient +from archastro.platform import AsyncPlatformClient, PlatformClient from archastro.platform.runtime.http_client import ApiError PRISM_URL = "http://127.0.0.1:4040" @@ -26,208 +26,641 @@ def _error_client(code: int) -> PlatformClient: ) -async def test_users_me_success(): - client = _client() - result = await client.v1.users.me() - assert result is not None +def _async_client() -> AsyncPlatformClient: + return AsyncPlatformClient( + base_url=PRISM_URL, + default_headers={"x-archastro-api-key": "pk_test-key"}, + access_token="test-token", + ) -async def test_users_me_error_401(): - ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.users.me() - assert exc_info.value.status == 401 +def _async_error_client(code: int) -> AsyncPlatformClient: + return AsyncPlatformClient( + base_url=PRISM_URL, + default_headers={"x-archastro-api-key": "pk_test-key", "Prefer": f"code={code}"}, + access_token="test-token", + ) -async def test_users_get_success(): +def test_users_me_success(): client = _client() - result = await client.v1.users.get("test-value") - assert result is not None + try: + result = client.v1.users.me() + assert result is not None + finally: + client.close() -async def test_users_get_error_401(): +def test_users_me_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.users.get("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.users.me() + assert exc_info.value.status == 401 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_users_me_success(): + client = _async_client() + try: + result = await client.v1.users.me() + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_users_me_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.users.me() + assert exc_info.value.status == 401 + finally: + await ec.close() + + +def test_users_get_success(): + client = _client() + try: + result = client.v1.users.get("test-value") + assert result is not None + finally: + client.close() -async def test_users_get_error_403(): - ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.users.get("test-value") - assert exc_info.value.status == 403 +def test_users_get_error_401(): + ec = _error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.users.get("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_users_invites_success(): +def test_users_get_error_403(): + ec = _error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.users.get("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_users_get_success(): + client = _async_client() + try: + result = await client.v1.users.get("test-value") + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_users_get_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.users.get("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_users_get_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.users.get("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +def test_users_invites_success(): client = _client() - result = await client.v1.users.invites("test-value", {"invite": {}}) - assert result is not None + try: + result = client.v1.users.invites("test-value", {"invite": {}}) + assert result is not None + finally: + client.close() -async def test_users_invites_error_401(): +def test_users_invites_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.users.invites("test-value", {"invite": {}}) - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.users.invites("test-value", {"invite": {}}) + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_users_invites_error_403(): +def test_users_invites_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.users.invites("test-value", {"invite": {}}) - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.users.invites("test-value", {"invite": {}}) + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_users_invites_error_404(): +def test_users_invites_error_404(): ec = _error_client(404) - with pytest.raises(ApiError) as exc_info: - await ec.v1.users.invites("test-value", {"invite": {}}) - assert exc_info.value.status == 404 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.users.invites("test-value", {"invite": {}}) + assert exc_info.value.status == 404 + finally: + ec.close() -async def test_users_invites_error_409(): +def test_users_invites_error_409(): ec = _error_client(409) - with pytest.raises(ApiError) as exc_info: - await ec.v1.users.invites("test-value", {"invite": {}}) - assert exc_info.value.status == 409 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.users.invites("test-value", {"invite": {}}) + assert exc_info.value.status == 409 + finally: + ec.close() -async def test_users_invites_error_422(): +def test_users_invites_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.users.invites("test-value", {"invite": {}}) - assert exc_info.value.status == 422 - - -async def test_users_orgs_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.users.invites("test-value", {"invite": {}}) + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_users_invites_success(): + client = _async_client() + try: + result = await client.v1.users.invites("test-value", {"invite": {}}) + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_users_invites_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.users.invites("test-value", {"invite": {}}) + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_users_invites_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.users.invites("test-value", {"invite": {}}) + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_users_invites_error_404(): + ec = _async_error_client(404) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.users.invites("test-value", {"invite": {}}) + assert exc_info.value.status == 404 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_users_invites_error_409(): + ec = _async_error_client(409) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.users.invites("test-value", {"invite": {}}) + assert exc_info.value.status == 409 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_users_invites_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.users.invites("test-value", {"invite": {}}) + assert exc_info.value.status == 422 + finally: + await ec.close() + + +def test_users_orgs_success(): client = _client() - result = await client.v1.users.orgs("test-value") - assert result is not None - assert "data" in result - assert isinstance(result["data"], list) + try: + result = client.v1.users.orgs("test-value") + assert result is not None + assert "data" in result + assert isinstance(result["data"], list) + finally: + client.close() -async def test_users_orgs_error_401(): +def test_users_orgs_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.users.orgs("test-value") - assert exc_info.value.status == 401 - - -async def test_users_profile_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.users.orgs("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_users_orgs_success(): + client = _async_client() + try: + result = await client.v1.users.orgs("test-value") + assert result is not None + assert "data" in result + assert isinstance(result["data"], list) + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_users_orgs_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.users.orgs("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +def test_users_profile_success(): client = _client() - result = await client.v1.users.profile("test-value", {}) - assert result is not None + try: + result = client.v1.users.profile("test-value", {}) + assert result is not None + finally: + client.close() -async def test_users_profile_error_401(): +def test_users_profile_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.users.profile("test-value", {}) - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.users.profile("test-value", {}) + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_users_profile_error_422(): +def test_users_profile_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.users.profile("test-value", {}) - assert exc_info.value.status == 422 - - -async def test_users_artifacts_list_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.users.profile("test-value", {}) + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_users_profile_success(): + client = _async_client() + try: + result = await client.v1.users.profile("test-value", {}) + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_users_profile_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.users.profile("test-value", {}) + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_users_profile_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.users.profile("test-value", {}) + assert exc_info.value.status == 422 + finally: + await ec.close() + + +def test_users_artifacts_list_success(): client = _client() - result = await client.v1.users.artifacts.list("test-value") - assert result is not None - assert "data" in result - assert isinstance(result["data"], list) + try: + result = client.v1.users.artifacts.list("test-value") + assert result is not None + assert "data" in result + assert isinstance(result["data"], list) + finally: + client.close() -async def test_users_artifacts_list_error_401(): +def test_users_artifacts_list_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.users.artifacts.list("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.users.artifacts.list("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_users_artifacts_list_error_403(): +def test_users_artifacts_list_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.users.artifacts.list("test-value") - assert exc_info.value.status == 403 - - -async def test_users_artifacts_create_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.users.artifacts.list("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_users_artifacts_list_success(): + client = _async_client() + try: + result = await client.v1.users.artifacts.list("test-value") + assert result is not None + assert "data" in result + assert isinstance(result["data"], list) + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_users_artifacts_list_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.users.artifacts.list("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_users_artifacts_list_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.users.artifacts.list("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +def test_users_artifacts_create_success(): client = _client() - result = await client.v1.users.artifacts.create("test-value", {"artifact": {}}) - assert result is not None + try: + result = client.v1.users.artifacts.create("test-value", {"artifact": {}}) + assert result is not None + finally: + client.close() -async def test_users_artifacts_create_error_401(): +def test_users_artifacts_create_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.users.artifacts.create("test-value", {"artifact": {}}) - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.users.artifacts.create("test-value", {"artifact": {}}) + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_users_artifacts_create_error_403(): +def test_users_artifacts_create_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.users.artifacts.create("test-value", {"artifact": {}}) - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.users.artifacts.create("test-value", {"artifact": {}}) + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_users_artifacts_create_error_422(): +def test_users_artifacts_create_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.users.artifacts.create("test-value", {"artifact": {}}) - assert exc_info.value.status == 422 - - -async def test_users_threads_list_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.users.artifacts.create("test-value", {"artifact": {}}) + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_users_artifacts_create_success(): + client = _async_client() + try: + result = await client.v1.users.artifacts.create("test-value", {"artifact": {}}) + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_users_artifacts_create_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.users.artifacts.create("test-value", {"artifact": {}}) + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_users_artifacts_create_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.users.artifacts.create("test-value", {"artifact": {}}) + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_users_artifacts_create_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.users.artifacts.create("test-value", {"artifact": {}}) + assert exc_info.value.status == 422 + finally: + await ec.close() + + +def test_users_threads_list_success(): client = _client() - result = await client.v1.users.threads.list("test-value") - assert result is not None - assert "data" in result - assert isinstance(result["data"], list) + try: + result = client.v1.users.threads.list("test-value") + assert result is not None + assert "data" in result + assert isinstance(result["data"], list) + finally: + client.close() -async def test_users_threads_list_error_401(): +def test_users_threads_list_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.users.threads.list("test-value") - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.users.threads.list("test-value") + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_users_threads_list_error_403(): +def test_users_threads_list_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.users.threads.list("test-value") - assert exc_info.value.status == 403 - - -async def test_users_threads_create_success(): + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.users.threads.list("test-value") + assert exc_info.value.status == 403 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_users_threads_list_success(): + client = _async_client() + try: + result = await client.v1.users.threads.list("test-value") + assert result is not None + assert "data" in result + assert isinstance(result["data"], list) + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_users_threads_list_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.users.threads.list("test-value") + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_users_threads_list_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.users.threads.list("test-value") + assert exc_info.value.status == 403 + finally: + await ec.close() + + +def test_users_threads_create_success(): client = _client() - result = await client.v1.users.threads.create("test-value", {"thread": {}}) - assert result is not None + try: + result = client.v1.users.threads.create("test-value", {"thread": {}}) + assert result is not None + finally: + client.close() -async def test_users_threads_create_error_401(): +def test_users_threads_create_error_401(): ec = _error_client(401) - with pytest.raises(ApiError) as exc_info: - await ec.v1.users.threads.create("test-value", {"thread": {}}) - assert exc_info.value.status == 401 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.users.threads.create("test-value", {"thread": {}}) + assert exc_info.value.status == 401 + finally: + ec.close() -async def test_users_threads_create_error_403(): +def test_users_threads_create_error_403(): ec = _error_client(403) - with pytest.raises(ApiError) as exc_info: - await ec.v1.users.threads.create("test-value", {"thread": {}}) - assert exc_info.value.status == 403 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.users.threads.create("test-value", {"thread": {}}) + assert exc_info.value.status == 403 + finally: + ec.close() -async def test_users_threads_create_error_422(): +def test_users_threads_create_error_422(): ec = _error_client(422) - with pytest.raises(ApiError) as exc_info: - await ec.v1.users.threads.create("test-value", {"thread": {}}) - assert exc_info.value.status == 422 + try: + with pytest.raises(ApiError) as exc_info: + ec.v1.users.threads.create("test-value", {"thread": {}}) + assert exc_info.value.status == 422 + finally: + ec.close() + + +@pytest.mark.asyncio +async def test_async_users_threads_create_success(): + client = _async_client() + try: + result = await client.v1.users.threads.create("test-value", {"thread": {}}) + assert result is not None + finally: + await client.close() + + +@pytest.mark.asyncio +async def test_async_users_threads_create_error_401(): + ec = _async_error_client(401) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.users.threads.create("test-value", {"thread": {}}) + assert exc_info.value.status == 401 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_users_threads_create_error_403(): + ec = _async_error_client(403) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.users.threads.create("test-value", {"thread": {}}) + assert exc_info.value.status == 403 + finally: + await ec.close() + + +@pytest.mark.asyncio +async def test_async_users_threads_create_error_422(): + ec = _async_error_client(422) + try: + with pytest.raises(ApiError) as exc_info: + await ec.v1.users.threads.create("test-value", {"thread": {}}) + assert exc_info.value.status == 422 + finally: + await ec.close()