Skip to content

Commit

Permalink
test: Improve tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ewuerger committed Dec 12, 2024
1 parent 64d0692 commit fa8ffa6
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 159 deletions.
16 changes: 7 additions & 9 deletions tests/test_elements.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
TEST_ACTOR_UUID = "08e02248-504d-4ed8-a295-c7682a614f66"
TEST_PHYS_COMP = "b9f9a83c-fb02-44f7-9123-9d86326de5f1"
TEST_PHYS_NODE = "8a6d68c8-ac3d-4654-a07e-ada7adeed09f"
TEST_PHYS_FNC = "11906f7b-3ae9-4343-b998-95b170be2e2b"
TEST_SCENARIO = "afdaa095-e2cd-4230-b5d3-6cb771a90f51"
TEST_CAP_REAL = "b80b3141-a7fc-48c7-84b2-1467dcef5fce"
TEST_CONSTRAINT = "95cbd4af-7224-43fe-98cb-f13dda540b8e"
Expand Down Expand Up @@ -1861,24 +1862,23 @@ def test_generic_work_item(

@staticmethod
def test_add_context_diagram(model: capellambse.MelodyModel):
uuid = "11906f7b-3ae9-4343-b998-95b170be2e2b"
type_config = converter_config.CapellaTypeConfig(
"test", "add_context_diagram", []
)
serializer = element_converter.CapellaWorkItemSerializer(
model,
polarion_repo.PolarionDataRepository(),
{
uuid: data_session.ConverterData(
TEST_PHYS_FNC: data_session.ConverterData(
"pa",
type_config,
model.by_uuid(uuid),
model.by_uuid(TEST_PHYS_FNC),
)
},
True,
)

work_item = serializer.serialize(uuid)
work_item = serializer.serialize(TEST_PHYS_FNC)

assert work_item is not None
assert "context_diagram" in work_item.additional_attributes
Expand Down Expand Up @@ -2154,7 +2154,6 @@ def test_read_config_tree_view_with_params(
with mock.patch.object(
context.ContextDiagram, "render"
) as wrapped_render:

wis = serializer.serialize_all()
_ = wis[0].attachments[0].content_bytes

Expand Down Expand Up @@ -2204,25 +2203,24 @@ def test_read_config_links(caplog: pytest.LogCaptureFixture):

@staticmethod
def test_add_context_diagram_with_caption(model: capellambse.MelodyModel):
uuid = "11906f7b-3ae9-4343-b998-95b170be2e2b"
type_config = converter_config.CapellaTypeConfig(
"test", "add_context_diagram", []
)
serializer = element_converter.CapellaWorkItemSerializer(
model,
polarion_repo.PolarionDataRepository(),
{
uuid: data_session.ConverterData(
TEST_PHYS_FNC: data_session.ConverterData(
"pa",
type_config,
model.by_uuid(uuid),
model.by_uuid(TEST_PHYS_FNC),
)
},
True,
generate_figure_captions=True,
)

work_item = serializer.serialize(uuid)
work_item = serializer.serialize(TEST_PHYS_FNC)

assert work_item is not None
assert "context_diagram" in work_item.additional_attributes
Expand Down
Loading

0 comments on commit fa8ffa6

Please sign in to comment.