fix(api): include simulation burst ids

This commit is contained in:
2026-07-16 14:50:22 +08:00
parent 9f7f5536d7
commit 6f9c94a4dd
2 changed files with 48 additions and 0 deletions
+17
View File
@@ -75,6 +75,7 @@ def _load_burst_location_module():
scheme_management_module = types.ModuleType("app.services.scheme_management")
scheme_management_module.query_burst_location_scheme_detail = lambda *args, **kwargs: {}
scheme_management_module.query_burst_location_schemes = lambda *args, **kwargs: []
scheme_management_module.query_scheme_list = lambda *args, **kwargs: []
scheme_management_module.scheme_name_exists = lambda *args, **kwargs: False
scheme_management_module.store_scheme_info = lambda *args, **kwargs: None
sys.modules["app.services.scheme_management"] = scheme_management_module
@@ -177,6 +178,21 @@ def test_run_burst_location_uses_single_timerange_with_burst_source_split(monkey
"query_realtime_simulation_by_ids_timerange",
staticmethod(fake_realtime_query),
)
monkeypatch.setattr(
module,
"query_scheme_list",
lambda name: [
(
1,
"BurstSchemeA",
"burst_analysis",
"testuser",
None,
None,
{"burst_ID": ["Pipe-009", "Pipe-010"]},
)
],
)
result = module.run_burst_location_by_network(
network="tjwater",
@@ -194,6 +210,7 @@ def test_run_burst_location_uses_single_timerange_with_burst_source_split(monkey
assert result["simulation_scheme"] == {
"name": "BurstSchemeA",
"type": "burst_analysis",
"burst_ids": ["Pipe-009", "Pipe-010"],
}
assert result["pressure_samples"] == {"burst": 4, "normal": 4}
assert result["flow_samples"] == {"burst": 4, "normal": 4}