Skip to content

Commit

Permalink
fix: Link role for includes
Browse files Browse the repository at this point in the history
  • Loading branch information
ewuerger authored Aug 22, 2024
2 parents 42825f5 + 05bb2d1 commit 35d4b56
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions capella2polarion/converters/link_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,13 +225,13 @@ def create_grouped_link_fields(
key = link.secondary_work_item_id
back_links.setdefault(key, []).append(link)

role_id = self._remove_prefix(role)
config: converter_config.LinkConfig | None = None
for link_config in data.type_config.links:
if link_config.polarion_role == role:
if link_config.polarion_role == role_id:
config = link_config
break

role_id = self._remove_prefix(role)
self._create_link_fields(
work_item, role_id, grouped_links, config=config
)
Expand Down
7 changes: 6 additions & 1 deletion tests/test_elements.py
Original file line number Diff line number Diff line change
Expand Up @@ -1219,8 +1219,11 @@ def test_maintain_grouped_links_attributes_with_role_prefix(
assert "attribute" in dummy_work_items["uuid1"].additional_attributes

@staticmethod
@pytest.mark.parametrize("role_prefix", ["", "_C2P"])
def test_grouped_links_attributes_with_includes(
base_object: BaseObjectContainer, model: capellambse.MelodyModel
base_object: BaseObjectContainer,
model: capellambse.MelodyModel,
role_prefix: str,
):
fnc = model.by_uuid(TEST_SYS_FNC)
ex = model.by_uuid(TEST_SYS_FNC_EX)
Expand Down Expand Up @@ -1257,6 +1260,7 @@ def test_grouped_links_attributes_with_includes(
converter = model_converter.ModelConverter(
base_object.c2pcli.capella_model,
base_object.c2pcli.polarion_params.project_id,
role_prefix=role_prefix,
)
converter.converter_session = base_object.mc.converter_session
work_items = converter.generate_work_items(
Expand All @@ -1274,6 +1278,7 @@ def test_grouped_links_attributes_with_includes(
base_object.mc.converter_session,
base_object.pw.polarion_params.project_id,
base_object.c2pcli.capella_model,
role_prefix=role_prefix,
)
backlinks: dict[str, list[polarion_api.WorkItemLink]] = {}
work_item = (
Expand Down

0 comments on commit 35d4b56

Please sign in to comment.