Skip to content

fix: restore receipt endpoint request injection test#45

Merged
ianalloway merged 1 commit into
mainfrom
fix/receipt-test-request-injection
Jun 30, 2026
Merged

fix: restore receipt endpoint request injection test#45
ianalloway merged 1 commit into
mainfrom
fix/receipt-test-request-injection

Conversation

@ianalloway

Copy link
Copy Markdown
Owner

Summary

  • Fixes the receipt endpoint test's FastAPI Request injection under postponed annotations
  • Removes the optional Request default so localhost TestClient requests are recognized correctly
  • Keeps FastAPI imports lazy so tests still skip cleanly when optional server deps are absent

Test Plan

  • .venv/bin/python -m pytest tests/test_receipt.py::TestReceiptEndpoint::test_200_for_valid_job_from_localhost -q
  • .venv/bin/python -m pytest tests/test_receipt.py -q
  • .venv/bin/python -m pytest tests/ -q

Copilot AI review requested due to automatic review settings June 30, 2026 17:18

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 31fd802a93

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tests/test_receipt.py

@_app.get("/api/receipt/{job_id}")
def _get_receipt(job_id: str, token: str = "", request: Request = None):
def _get_receipt(request: Request, job_id: str, token: str = ""):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep valid-token test off the localhost bypass

With this new injected Request, the TestClient request is now classified as local by the helper's localhost whitelist, so test_valid_token_grants_access no longer exercises verify_delivery_token at all; the test would pass with an invalid token as long as the job exists. Please force that test through a non-local client host or otherwise make is_local false so it still covers token-gated receipt access.

Useful? React with 👍 / 👎.

@ianalloway ianalloway merged commit 7d21c4a into main Jun 30, 2026
5 checks passed
@ianalloway ianalloway deleted the fix/receipt-test-request-injection branch June 30, 2026 17:22
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.

2 participants