free-claude-code/smoke/test_client_shapes_live.py
Ali Khokhar 462a9430bb
Add local live smoke test suite (#148)
## Summary
- add an opt-in local `smoke/` pytest suite for API, auth, providers,
CLI, IDE-shaped requests, messaging, voice, tools, and thinking stream
contracts
- keep smoke tests out of normal CI collection with `testpaths =
["tests"]`
- write sanitized smoke artifacts under `.smoke-results/`

## Verification
- `uv run ruff format`
- `uv run ruff check`
- `uv run ty check`
- `uv run ty check smoke`
- `FCC_LIVE_SMOKE=1 FCC_SMOKE_TARGETS=all FCC_SMOKE_RUN_VOICE=1 uv run
pytest smoke -n 0 -m live -s --tb=short` -> 17 passed, 9 skipped
- `uv run pytest` -> 904 passed

## Notes
- Skipped live checks require local credentials/tools/services, such as
provider models, Telegram/Discord targets, voice backend, or Claude CLI.
- `claude-pick` smoke was intentionally removed.
2026-04-23 19:06:09 -07:00

49 lines
1.5 KiB
Python

from __future__ import annotations
import pytest
from smoke.lib.config import SmokeConfig, auth_headers
from smoke.lib.http import message_payload, post_json
from smoke.lib.server import RunningServer
pytestmark = [pytest.mark.live, pytest.mark.smoke_target("vscode")]
def test_vscode_and_jetbrains_shaped_requests(
smoke_server: RunningServer,
smoke_config: SmokeConfig,
) -> None:
payload = message_payload("quota", max_tokens=1)
vscode_headers = auth_headers()
vscode_headers.update(
{
"anthropic-beta": "messages-2023-12-15",
"user-agent": "Claude-Code-VSCode smoke",
}
)
vscode = post_json(
smoke_server,
"/v1/messages?beta=true",
payload,
smoke_config,
headers=vscode_headers,
)
assert vscode.status_code == 200, vscode.text
assert vscode.json()["content"][0]["text"] == "Quota check passed."
jetbrains_headers = auth_headers()
token = smoke_config.settings.anthropic_auth_token
if token:
jetbrains_headers.pop("x-api-key", None)
jetbrains_headers["authorization"] = f"Bearer {token}"
jetbrains_headers["user-agent"] = "JetBrains-ACP smoke"
jetbrains = post_json(
smoke_server,
"/v1/messages",
payload,
smoke_config,
headers=jetbrains_headers,
)
assert jetbrains.status_code == 200, jetbrains.text
assert jetbrains.json()["content"][0]["text"] == "Quota check passed."