11import pytest
22
3- from techui_builder .models import Beamline , Component
3+ from techui_builder .models import (
4+ Beamline ,
5+ Component ,
6+ GuiComponentEntry ,
7+ GuiComponents ,
8+ )
49
510
611@pytest .fixture
@@ -13,6 +18,13 @@ def component() -> Component:
1318 return Component (prefix = "BL01T-EA-TEST-02" , desc = "Test Device" )
1419
1520
21+ @pytest .fixture
22+ def gui_components () -> GuiComponentEntry :
23+ return GuiComponentEntry (
24+ file = "digitelMpc/digitelMpcIonp.bob" , prefix = "$(P)" , type = "embedded"
25+ )
26+
27+
1628# @pytest.mark.parametrize("beamline,expected",[])
1729def test_beamline_object (beamline : Beamline ):
1830 assert beamline .short_dom == "t01"
@@ -39,3 +51,18 @@ def test_component_repr(component: Component):
3951def test_component_bad_prefix ():
4052 with pytest .raises (ValueError ):
4153 Component (prefix = "Test 2" , desc = "BAD_PREFIX" )
54+
55+
56+ def test_gui_component_entry (gui_components : GuiComponentEntry ):
57+ assert gui_components .file == "digitelMpc/digitelMpcIonp.bob"
58+ assert gui_components .prefix == "$(P)"
59+ assert gui_components .type == "embedded"
60+
61+
62+ def test_gui_components_object (gui_components : GuiComponentEntry ):
63+ gc = GuiComponents ({"digitelMpc.digitelMpcIonp" : [gui_components ]})
64+ entry = gc .root ["digitelMpc.digitelMpcIonp" ][0 ]
65+ assert entry .file == "digitelMpc/digitelMpcIonp.bob"
66+
67+ assert entry .prefix == "$(P)"
68+ assert entry .type == "embedded"
0 commit comments