fix(tests): align stale tests with current API + bypass identity-map cache
- test_recipes: split update test into in-place vs copy-on-write paths (PUT now updates in-place when current version has no measurements). Added _seed_measurement() helper to force copy-on-write where needed. - test_tasks::reorder: expunge_all() between POST and GET so the shared test session re-fetches RecipeVersion.tasks instead of returning the cached collection. Prod uses one session per request, so identity-map staleness only affects tests. - test_measure::save_measurement_proxy: payload aligned to current API (version_id is required; pass_fail/deviation are computed server-side). All 179 tests green. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -61,7 +61,7 @@ class TestSaveMeasurement:
|
||||
mock_api_client.post.return_value = {
|
||||
"id": 1,
|
||||
"subtask_id": 10,
|
||||
"task_id": 5,
|
||||
"version_id": 3,
|
||||
"value": 9.95,
|
||||
"pass_fail": "pass",
|
||||
}
|
||||
@@ -70,10 +70,8 @@ class TestSaveMeasurement:
|
||||
"/measure/save-measurement",
|
||||
json={
|
||||
"subtask_id": 10,
|
||||
"task_id": 5,
|
||||
"version_id": 3,
|
||||
"value": 9.95,
|
||||
"pass_fail": "pass",
|
||||
"deviation": 0.05,
|
||||
},
|
||||
content_type="application/json",
|
||||
)
|
||||
@@ -86,7 +84,7 @@ class TestSaveMeasurement:
|
||||
"""Missing required fields return 400."""
|
||||
resp = logged_in_client.post(
|
||||
"/measure/save-measurement",
|
||||
json={"subtask_id": 10}, # missing task_id and value
|
||||
json={"subtask_id": 10}, # missing version_id and value
|
||||
content_type="application/json",
|
||||
)
|
||||
assert resp.status_code == 400
|
||||
|
||||
Reference in New Issue
Block a user