This repository was archived by the owner on Jan 21, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -157,6 +157,23 @@ def test_model_cannot_add_two_software_systems_with_same_name(empty_model: Model
157
157
empty_model .add_software_system (name = "Bob" )
158
158
159
159
160
+ def test_model_get_software_system_bad_id (empty_model : Model ):
161
+ """Test that trying to get a system by a non-system ID returns None."""
162
+ system = empty_model .add_software_system (name = "System" )
163
+ container = system .add_container (name = "Container" )
164
+
165
+ assert empty_model .get_software_system_with_id (container .id ) is None
166
+
167
+
168
+ def test_model_add_element_with_existing_id_raises_error (empty_model : Model ):
169
+ """Test you can't add an element with the same ID as an existing one."""
170
+ system1 = empty_model .add_software_system (name = "System" )
171
+ system2 = SoftwareSystem (name = "System2" , id = system1 .id )
172
+
173
+ with pytest .raises (ValueError , match = "The element .* has an existing ID" ):
174
+ empty_model += system2
175
+
176
+
160
177
def test_model_automatically_adds_child_elements (empty_model : Model ):
161
178
"""Check that adding a parent element to the model also adds its children."""
162
179
system = SoftwareSystem (name = "System" )
You can’t perform that action at this time.
0 commit comments