mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-08-03 05:18:22 +00:00
Attribute a rename run to its request and target site 🟩
Green on arrival: @task_handler records inputs and reads source_id from the body key matching the source's value. Pinned because it is the only place the new sharepoint_site member is proven against a real Postgres enum rather than a Python one. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
1213b80e3f
commit
0836b18d5b
1 changed files with 28 additions and 0 deletions
|
|
@ -199,6 +199,34 @@ def test_completed_subtask_carries_the_run_summary(
|
|||
}
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# A run is attributable: its request, and the site it targeted
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
def test_run_records_its_request_and_target_site(
|
||||
harness: Harness, tmp_path: Path, monkeypatch: pytest.MonkeyPatch
|
||||
) -> None:
|
||||
"""``sharepoint_site`` round-trips through the real ``source`` pgEnum — the
|
||||
member the FE's Drizzle migration must add before this deploys."""
|
||||
# Arrange
|
||||
sharepoint = FakeSharepoint(_one_property_site())
|
||||
_install(monkeypatch, tmp_path, sharepoint)
|
||||
body = {"sharepoint_site": SITE, "dry_run": True}
|
||||
|
||||
# Act
|
||||
result = _handler(harness)(_sqs_event(body), None)
|
||||
|
||||
# Assert
|
||||
task = harness.tasks.get(_task_id(result))
|
||||
assert (task.task_source, task.source, task.source_id) == (
|
||||
"sharepoint_renamer",
|
||||
Source.SHAREPOINT_SITE,
|
||||
SITE,
|
||||
)
|
||||
assert harness.subtasks.get(_subtask_id(result)).inputs == body
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# A queue-delivered dry run is actually a dry run
|
||||
# ---------------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue