Skip to content
This repository was archived by the owner on Jan 21, 2023. It is now read-only.

Commit 7c4bc53

Browse files
yt-msMidnighter
authored andcommitted
test(Model): improve coverage
1 parent 22680f5 commit 7c4bc53

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/unit/model/test_model.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,23 @@ def test_model_cannot_add_two_software_systems_with_same_name(empty_model: Model
157157
empty_model.add_software_system(name="Bob")
158158

159159

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+
160177
def test_model_automatically_adds_child_elements(empty_model: Model):
161178
"""Check that adding a parent element to the model also adds its children."""
162179
system = SoftwareSystem(name="System")

0 commit comments

Comments
 (0)