STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
test_parameter_sections.py
Go to the documentation of this file.
1"""The Configuration tab's section list (GET /api/config/parameters, engine/pipeline/parameter_registry).
2
3Two sections were both labelled "Propellants" (fluids and propellant_preset), and the legacy
4chamber/nozzle blocks and the app's own staleness stamp were listed beside the live sections as
5if a person should fill them in.
6"""
7
8from pathlib import Path
9
10from engine.pipeline.io import load_config
11from engine.pipeline.parameter_registry import INTERNAL_SECTIONS, LEGACY_SECTIONS, SECTIONS, config_parameters
12
13ROOT = Path(__file__).resolve().parents[1]
14
15
17 labels = [label for _, label in SECTIONS]
18 assert len(labels) == len(set(labels)), labels
19
20
22 out = config_parameters(load_config(ROOT / "configs" / "default.yaml"))
23 by_key = {s["key"]: s for s in out["sections"]}
24 assert len({s["label"] for s in out["sections"]}) == len(out["sections"])
25 for key, s in by_key.items():
26 assert s["legacy"] is (key in LEGACY_SECTIONS)
27 assert s["internal"] is (key in INTERNAL_SECTIONS)
28 assert by_key["fluids"]["legacy"] is False and by_key["fluids"]["internal"] is False
29 if "chamber" in by_key:
30 assert by_key["chamber"]["legacy"] is True