mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-08-03 05:18:22 +00:00
The local invoke now sends an SQS-shaped payload — a direct invoke is the one shape that cannot reproduce the dry_run bug class. Test modules route protected-method calls through typed helpers so both pass pyright strict. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
39 lines
1.2 KiB
Python
39 lines
1.2 KiB
Python
#!/usr/bin/env python3
|
|
"""Invoke the locally-running Renamer image with a realistic SQS payload.
|
|
|
|
The event is hand-built SQS-shaped on purpose. A direct invoke (a bare body,
|
|
no ``Records``) is the one path where the request is read the same way whether
|
|
or not the record body is unwrapped — so it is the one path that would NOT have
|
|
caught ``dry_run`` being ignored on queue-triggered runs. Exercise the shape
|
|
production actually delivers.
|
|
|
|
This writes a real task + sub_task row to whatever database ``.env`` points at
|
|
(dev), and is the only place the production Postgres driver is exercised — the
|
|
tests use a different one. ``dry_run`` is True so nothing is renamed for real.
|
|
"""
|
|
|
|
import json
|
|
|
|
import requests
|
|
|
|
HOST = "localhost"
|
|
PORT = "9003"
|
|
|
|
LAMBDA_URL = f"http://{HOST}:{PORT}/2015-03-31/functions/function/invocations"
|
|
|
|
payload = {
|
|
"Records": [
|
|
{
|
|
"messageId": "local-test-1",
|
|
"body": json.dumps(
|
|
{"sharepoint_site": "SOCIAL_HOUSING_WAVE_3", "dry_run": True}
|
|
),
|
|
}
|
|
]
|
|
}
|
|
|
|
response = requests.post(LAMBDA_URL, json=payload)
|
|
|
|
print("Status code:", response.status_code)
|
|
print("Response:")
|
|
print(response.text)
|