fix(scada): preserve observation fields in chart evidence
This commit is contained in:
@@ -1116,6 +1116,31 @@ def test_time_series_sql_is_bounded_and_field_names_cannot_inject_sql():
|
||||
asyncio.run(check())
|
||||
|
||||
|
||||
@pytest.mark.parametrize("field", ["monitored_value", "cleaned_value"])
|
||||
def test_scada_detail_preserves_the_requested_field_with_its_value_alias(monkeypatch, field):
|
||||
at = datetime.now(timezone.utc)
|
||||
monkeypatch.setattr(query_service, "permissions_for_context", lambda ctx: PERMISSIONS)
|
||||
monkeypatch.setattr(query_service.reads, "series_rows", AsyncMock(return_value=[{
|
||||
"device_id": "D1", "time": at, "value": 32.0,
|
||||
}]))
|
||||
monkeypatch.setattr(query_service.reads, "scada_devices", AsyncMock(return_value=[{
|
||||
"device_id": "D1", "measurement_unit": "m",
|
||||
}]))
|
||||
|
||||
class Scope:
|
||||
project = object()
|
||||
connection = Connection()
|
||||
|
||||
@asynccontextmanager
|
||||
async def timescale(self):
|
||||
yield self.connection
|
||||
|
||||
args = ScadaInput(context_handle="a" * 43, device_ids=["D1"], field=field,
|
||||
start=at - timedelta(hours=3), end=at)
|
||||
result = asyncio.run(query_service.execute_query(Scope(), binding(), TOOLS["query_scada_readings"], args))
|
||||
assert result.data[0][field] == result.data[0]["value"] == 32.0
|
||||
|
||||
|
||||
def test_analysis_preserves_run_units_and_reports_inference(monkeypatch):
|
||||
from app.mcp.models import AnalysisValuesInput
|
||||
from unittest.mock import AsyncMock
|
||||
|
||||
Reference in New Issue
Block a user