From 28d7ef02ad6333a1da180acf00633eaa5f41fce1 Mon Sep 17 00:00:00 2001 From: demo-bot Date: Sun, 9 Aug 2026 15:09:14 +0000 Subject: [PATCH] decomposer: generate files for Maintain only the latest check result for each monitored target in concurrency-safe memory and expose it through the specified FastAPI current-status endpoint. --- tests/test_transform.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 tests/test_transform.py diff --git a/tests/test_transform.py b/tests/test_transform.py new file mode 100644 index 0000000..ecaaa40 --- /dev/null +++ b/tests/test_transform.py @@ -0,0 +1,28 @@ +from current_status import transform + + +def test_preserves_prior_outputs_and_emits_current_status_implementation() -> None: + source = { + "service_specification": {"name": "monitor"}, + "target_management_implementation": {"module": "targets"}, + "endpoint_check_implementation": {"module": "checker"}, + } + output = transform(source) + + for key in source: + assert output[key] == source[key] + assert output[key] is not source[key] + implementation = output["current_status_implementation"] + assert implementation["endpoint"] == "GET /targets/{target_id}/status" + assert implementation["no_check_yet"]["http_status"] == 200 + assert implementation["not_found"]["http_status"] == 404 + assert len(implementation["race_guards"]) == 2 + + +def test_rejects_missing_prior_contract_output() -> None: + try: + transform({}) + except ValueError as exc: + assert str(exc) == "service_specification must be an object" + else: + raise AssertionError("expected ValueError")