Skip to content

agent-friendly L2-1: HTTP handler contract tests - #16

Merged
patote85 merged 4 commits into
mainfrom
agent-friendly/l2-1-http-handler-tests
Sep 24, 2026
Merged

patote85 merged 4 commits into
mainfrom
agent-friendly/l2-1-http-handler-tests

Conversation

@patote85

Copy link
Copy Markdown
Owner

L2-1 — HTTP handler contract tests

Why

Existing handlers returned proxy-shaped dicts and took an event arg Powertools never injects, so HTTP status codes were not real (double-wrap / TypeError). Agents need a prove-it-works path through lambda_handler.

Changes

  • Fix lambda/app.py to use Powertools Response + app.current_event + <cliente_id> path syntax
  • Add tests/test_http_contract.py: GET /health → 200; POST missing cliente_id → 400; happy path request → status → confirm (moto)
  • Delete stub tests/test_app.py
  • Makefile + CI: pytest tests/ (same target)

Verification

  • Local: PYTHONPATH=. pytest tests/ -v → 7 passed; ruff + mypy green
  • Prova negativa: wrong health body assert fails; wrong 400→999 assert fails
  • No deploy / no TransactWrite / no real Pix

CAB waived (same as #5–#7).

Fix Powertools handlers (Response + current_event + <path>) so HTTP status codes are real.
Add tests/test_http_contract.py via lambda_handler; delete stub test_app.py.
Makefile/CI: pytest tests/ (same target).
@patote85
patote85 merged commit e1b35ed into main Sep 24, 2026
3 checks passed
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