Skip to content

Add baseline test harness and CI - #44

Draft
jsachs wants to merge 1 commit into
ulfsri:mainfrom
jsachs:codex/test-harness
Draft

Add baseline test harness and CI#44
jsachs wants to merge 1 commit into
ulfsri:mainfrom
jsachs:codex/test-harness

Conversation

@jsachs

@jsachs jsachs commented Aug 4, 2026

Copy link
Copy Markdown

Summary

This PR adds the first automated test foundation for the Python client:

  • seven offline unittest cases covering configuration, the password-token happy path, request construction, JSON/text responses, and Pydantic alias serialization;
  • reusable fake response and recording-session helpers for follow-up regression tests;
  • GitHub Actions coverage for Python 3.10 through 3.13;
  • a corrected minimum Python version of 3.10, matching syntax already used by the client; and
  • a documented local test command.

The tests invoke the real Config, _update_auth, and _call implementations. Only the external HTTP session is replaced, so the suite is deterministic and requires no credentials or network access. A mutation check confirmed that incorrect refresh-token storage and an incorrect Bearer header are both detected.

Scope and limitations

This is intentionally a baseline harness, not a complete OpenAPI compliance suite. It does not yet cover every endpoint, client-credentials and refresh flows, MFA, error handling, generated NERIS models, response schemas, or live API behavior. Those cases can be added safely after the focused fixes below land; OpenAPI drift and model-generation checks are planned as follow-up work.

Bugs identified during the test audit

The audit exposed several existing production issues, kept out of this foundation PR so each fix remains independently reviewable:

Finding Follow-up PR
Generated enums are not consistently serialized to their API values #35
Unit creation and patch routes are incorrect #36
Explicit configuration and user-agent values can be overridden incorrectly #37
HTTP session and authentication state are shared between client instances #38
JSON string payloads can be double-encoded #39
Documented token variants, errors, and missing refresh tokens are mishandled #43 (supersedes #40)
API HTTP errors are swallowed and returned instead of raised #42 (breaking change)
Package metadata incorrectly advertises Python 3.8 support fixed here; also isolated in #41

Verification

python -m unittest discover --start-directory tests --verbose

Ran 7 tests
OK

@jsachs
jsachs force-pushed the codex/test-harness branch from 66ce456 to 851556b Compare August 5, 2026 00:30
@jsachs
jsachs marked this pull request as draft August 5, 2026 12:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant