← ClaudeAtlas

flat-test-service-clientlisted

Use when testing one external-service HTTP client class with its transport stubbed — URL assembly, the outgoing request, response parsing, timeouts, translation into the service's catalog exception — bound here to `httpx2.MockTransport` under a real `httpx2` client. A unit test needing no database and no container, unlike `flat-test-entrypoint`, which stubs the same transport under the whole run against a real datastore. Not a hexagonal `ICan<Verb>` capability adapter — `hex-test-capability-adapter`, in the `pyhouse-hex` plugin.
wntic/pyhouse · ★ 3 · Code & Development · score 76
Install: claude install-skill wntic/pyhouse
# Flat-Layered Test — Service Client Consult `test-principles` for the testing constitution. Where this skill contradicts `test-principles`, the constitution wins. One unit-test file per client class, under the distribution's own `tests/unit/`. No database, no container, no network — the `httpx2.AsyncClient` the test hands the client has a stub as its transport, so everything the client itself does (URL assembly, headers, `raise_for_status`, JSON parsing, the `except httpx2.HTTPError` translation) runs unchanged. That is why this is a *unit* test despite involving HTTP: nothing crosses a process boundary. The client has no `Protocol` and needs none. The test substitutes the transport, which is somebody else's boundary — not an abstraction invented to make the code mockable. ## When to use vs. neighbours - The client wraps a vendor SDK rather than raw `httpx2` (a cloud SDK, a database driver) → not a stub transport; test it against the real thing in a container under this distribution's `tests/integration/`, or, where there is no container for it, against the SDK's own test double if it ships one. - The filter/normalize function the client's output feeds → a plain unit test with no fixtures; it is pure and needs nothing from this skill. - The work a trigger calls reaching this client → `flat-test-entrypoint`, which stubs the same transport under the whole run against a real datastore, and so lives under `tests/integration/`. - The catalog exception this client tra