Add contract test suite covering all resource modules - #20
Merged
Conversation
Adds HTTP-mocked (responses) pytest coverage for every public method across actionkit/, replacing the previous two tests that only covered pure string/regex helpers. Wires pytest into CI so the suite is actually gated. A few latent bugs surfaced during this work are pinned with regression tests documenting current (not endorsed) behavior; see follow-up issues for each. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
"ci" wasn't descriptive once pytest was added alongside the pins check -- name both the workflow and its job after what they actually run, and fix the header comment that still claimed the pins check was the whole job. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
responses) pytest suite covering every public method acrossactionkit/— connection/retry logic, baseHttpMethodsbehavior, and all resource modules — replacing the previous two tests that only covered pure string/regex helpers (_path(),Users.id()).responsesas a dev dependency; shared fixtures live intests/conftest.py/tests/urls.py.pytestinto.github/workflows/ci.ymlso the suite is actually gated on PRs, not just present locally.HttpMethodssubclasses with no added logic (signupactions,signuppages,genericpages,donationpages,userfields) don't get dedicated files — their behavior is already exercised bytests/test_httpmethods.py, plus a wiring smoke test intests/test_actionkit.py.Bugs found while writing this, filed separately (not fixed here)
Each is pinned with a regression test documenting current behavior, with an inline comment explaining why — not fixed as a side effect of adding tests:
Connection._make_requestconverts any body-bearing HTTP error toValidationErrorregardless of status code, likely making severalexcept HTTPError: if status_code == ...branches elsewhere in the codebase dead code in productionTransactions.create(order_id=...)always raisesTypeError(unbound method call)Uploads.upload()polls forever with no timeout and leaks an open file handleTransactions.reverse()'s "already reversed"ValidationErrorcheck can never matchPetitions.get()overrides the base class with an incompatible signatureTest plan
uv sync --group devpicks upresponseswithout touching runtime dependenciesuv run pytest— 199 passed, 0.23s locallycijob actually runs and reports pytest results once this PR is open🤖 Generated with Claude Code