File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed
Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -132,7 +132,7 @@ def hydrate(
132132 model += software_system
133133
134134 for container_io in software_system_io .containers :
135- Container .hydrate (
135+ software_system += Container .hydrate (
136136 container_io ,
137137 software_system = software_system ,
138138 model = model ,
Original file line number Diff line number Diff line change 1919import pytest
2020
2121from structurizr .model .container import Container
22- from structurizr .model .software_system import SoftwareSystem
22+ from structurizr .model .software_system import SoftwareSystem , SoftwareSystemIO
2323
2424
2525class MockModel :
@@ -135,3 +135,18 @@ def test_software_system_get_container_with_name(model_with_system: MockModel):
135135 container = empty_system .add_container (name = "Test" , description = "Description" )
136136 assert empty_system .get_container_with_name ("Test" ) is container
137137 assert empty_system .get_container_with_name ("FooBar" ) is None
138+
139+
140+ def test_software_system_serialisation (model_with_system : MockModel ):
141+ """Test systems are deserialised correctly."""
142+ empty_system = model_with_system .empty_system
143+ empty_system .add_container (name = "Test" , description = "Description" )
144+
145+ system_io = SoftwareSystemIO .from_orm (empty_system )
146+
147+ new_system = SoftwareSystem .hydrate (system_io , model_with_system )
148+ assert new_system .name == "Sys"
149+ assert len (new_system .containers ) == 1
150+ container = next (iter (new_system .containers ))
151+ assert container .name == "Test"
152+ assert container .parent is new_system
You can’t perform that action at this time.
0 commit comments