Skip to content

Commit

Permalink
Merge pull request #2023 from opsmill/wvd-20240123-sdk-fix-graphql-co…
Browse files Browse the repository at this point in the history
…mponent-mutation

SDK fix graphql relationship mutation of kind GROUP and COMPONENT
  • Loading branch information
wvandeun authored Jan 25, 2024
2 parents b1912a8 + c33e583 commit 2f06e9d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 0 additions & 2 deletions python_sdk/infrahub_sdk/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -739,8 +739,6 @@ def _generate_input_data(self, exclude_unmodified: bool = False) -> Dict[str, Di
rel_schema = self._schema.get_relationship(name=item_name)
if not rel_schema:
continue
if rel_schema.kind in [RelationshipKind.GROUP, RelationshipKind.COMPONENT]:
continue

rel: Union[RelatedNodeBase, RelationshipManagerBase] = getattr(self, item_name)

Expand Down
6 changes: 6 additions & 0 deletions python_sdk/tests/unit/sdk/test_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -849,6 +849,7 @@ async def test_create_input_data(client, location_schema, client_type):
"type": {"value": "SITE"},
# "primary_tag": None,
"tags": [],
"member_of_groups": [],
}
}

Expand Down Expand Up @@ -880,6 +881,7 @@ async def test_create_input_data__with_relationships_02(client, location_schema,
"type": {"value": "SITE"},
"tags": [{"id": "aaaaaa"}, {"id": "bbbb"}],
"primary_tag": {"id": "pppppppp"},
"member_of_groups": [],
}
}
assert input_data["data"] == expected
Expand All @@ -906,6 +908,7 @@ async def test_create_input_data__with_relationships_01(client, location_schema,
"type": {"value": "SITE"},
"tags": [{"id": "aaaaaa"}, {"id": "bbbb"}],
"primary_tag": {"id": "pppppppp"},
"member_of_groups": [],
}
}

Expand Down Expand Up @@ -1115,6 +1118,7 @@ async def test_update_input_data__with_relationships_01(
"primary_tag": {"id": "gggggggg-gggg-gggg-gggg-gggggggggggg"},
"tags": [{"id": "gggggggg-gggg-gggg-gggg-gggggggggggg"}],
"type": {"is_protected": True, "is_visible": True, "value": "SITE"},
"member_of_groups": [],
},
}

Expand Down Expand Up @@ -1155,6 +1159,7 @@ async def test_update_input_data_with_relationships_02(client, location_schema,
"source": "cccccccc-cccc-cccc-cccc-cccccccccccc",
"value": "SITE",
},
"member_of_groups": [],
},
}

Expand All @@ -1180,6 +1185,7 @@ async def test_update_input_data_empty_relationship(
# "primary_tag": None,
"tags": [],
"type": {"is_protected": True, "is_visible": True, "value": "SITE"},
"member_of_groups": [],
},
}

Expand Down

0 comments on commit 2f06e9d

Please sign in to comment.