feat(timeseries): unify element history queries
This commit is contained in:
@@ -159,6 +159,7 @@ def test_extended_simulation_stores_results_by_run_id(monkeypatch):
|
||||
lambda name: json.dumps(
|
||||
{
|
||||
"output": {
|
||||
"units": {"flow": "LPS", "pressure": "MTR"},
|
||||
"times": {"num_periods": 2, "report_step": 900},
|
||||
"node_results": [{"node": "J1", "result": [{}, {}]}],
|
||||
"link_results": [{"link": "P1", "result": [{}, {}]}],
|
||||
@@ -167,7 +168,12 @@ def test_extended_simulation_stores_results_by_run_id(monkeypatch):
|
||||
),
|
||||
)
|
||||
lifecycle_calls: list[tuple] = []
|
||||
monkeypatch.setattr(simulation, "create_analysis_run", lambda **kwargs: run_id)
|
||||
create_calls: list[dict] = []
|
||||
monkeypatch.setattr(
|
||||
simulation,
|
||||
"create_analysis_run",
|
||||
lambda **kwargs: (create_calls.append(kwargs), run_id)[1],
|
||||
)
|
||||
monkeypatch.setattr(
|
||||
simulation,
|
||||
"update_analysis_run",
|
||||
@@ -195,6 +201,10 @@ def test_extended_simulation_stores_results_by_run_id(monkeypatch):
|
||||
assert kwargs["db_name"] == "demo"
|
||||
assert returned_run_id == run_id
|
||||
assert lifecycle_calls[-1][1]["status"] == "completed"
|
||||
assert create_calls[0]["scheme_detail"]["result_units"] == {
|
||||
"flow": "LPS",
|
||||
"pressure": "MTR",
|
||||
}
|
||||
assert transaction_calls == [("begin", "demo"), ("end", "demo")]
|
||||
refresh_mock.assert_called_once_with("demo")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user