修改问题
This commit is contained in:
@@ -94,3 +94,41 @@ async def test_project_detail_create_failure_preserves_push_id_and_biz_id() -> N
|
||||
assert result.metadata["biz_id"] == "project-1"
|
||||
assert result.metadata["project_id"] == "project-1"
|
||||
assert result.metadata["key"] == "production"
|
||||
|
||||
|
||||
def test_project_detail_load_conflict_raises_on_same_project_key_different_data_id() -> None:
|
||||
collection = DataCollection("remote")
|
||||
|
||||
project = _ProjectNode(
|
||||
node_id="project-node-1",
|
||||
data_id="project-1",
|
||||
data={"id": "project-1"},
|
||||
)
|
||||
collection._nodes[project.node_id] = project
|
||||
|
||||
existing_detail = ProjectDetailSyncNode(
|
||||
node_id="detail-node-1",
|
||||
data_id="detail-old",
|
||||
data={
|
||||
"id": "detail-old",
|
||||
"project_id": "project-1",
|
||||
"key": "actual_construction",
|
||||
"value": [{"date": "2026-01-01", "capacity": 1.0}],
|
||||
},
|
||||
context={"project_id": "project-1"},
|
||||
)
|
||||
collection._nodes[existing_detail.node_id] = existing_detail
|
||||
collection._data_id_to_node_id[existing_detail.data_id] = existing_detail.node_id
|
||||
|
||||
handler = ProjectDetailApiHandler()
|
||||
handler.set_collection(collection)
|
||||
|
||||
with pytest.raises(RuntimeError, match="project_detail_data load conflict"):
|
||||
handler._create_node(
|
||||
{
|
||||
"id": "detail-new",
|
||||
"project_id": "project-1",
|
||||
"key": "actual_construction",
|
||||
"value": [{"date": "2026-01-02", "capacity": 2.0}],
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user