Expand governed Dataflow editor and node library

This commit is contained in:
2026-07-28 11:14:01 +02:00
parent df468a2bd8
commit dee8380631
22 changed files with 3564 additions and 291 deletions

43
tests/test_schemas.py Normal file
View File

@@ -0,0 +1,43 @@
from __future__ import annotations
import unittest
from govoplan_dataflow.backend.schemas import TabularSnapshotCreateRequest
class DataflowSchemaTests(unittest.TestCase):
def test_snapshot_request_requires_the_selected_format_payload(self) -> None:
json_request = TabularSnapshotCreateRequest(
name="Monthly cases",
source_name="monthly_cases",
format="json",
rows=[{"case_id": "0012"}],
)
csv_request = TabularSnapshotCreateRequest(
name="Monthly cases",
source_name="monthly_cases_csv",
format="csv",
csv_text="case_id;amount\n0012;7.5\n",
delimiter=";",
)
self.assertEqual([{"case_id": "0012"}], json_request.rows)
self.assertEqual(";", csv_request.delimiter)
with self.assertRaises(ValueError):
TabularSnapshotCreateRequest(
name="Missing rows",
source_name="missing_rows",
format="json",
)
with self.assertRaises(ValueError):
TabularSnapshotCreateRequest(
name="Ambiguous",
source_name="ambiguous",
format="csv",
rows=[],
csv_text="id\n1\n",
)
if __name__ == "__main__":
unittest.main()