Skip to content

Commit ff3f4aa

Browse files
committed
minor changes - fix test
1 parent a6fc80f commit ff3f4aa

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

infrahub_sdk/client.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1699,6 +1699,7 @@ async def convert_object_type(
16991699
"target_kind": target_kind,
17001700
},
17011701
branch_name=branch_name,
1702+
raise_for_error=True,
17021703
)
17031704
return await InfrahubNode.from_graphql(client=self, branch=branch_name, data=response["ConvertObjectType"])
17041705

@@ -3045,5 +3046,6 @@ def convert_object_type(
30453046
"target_kind": target_kind,
30463047
},
30473048
branch_name=branch_name,
3049+
raise_for_error=True,
30483050
)
30493051
return InfrahubNodeSync.from_graphql(client=self, branch=branch_name, data=response["ConvertObjectType"])

infrahub_sdk/convert_object_type.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class ConversionFieldValue(BaseModel): # Only one of these fields can be not No
2323
Holds the new value of the destination field during an object conversion.
2424
Use `attribute_value` to specify the new raw value of an attribute.
2525
Use `peer_id` to specify new peer of a cardinality one relationship.
26-
Use `peer_ids` to specify new peers of a cardinality many relationship.
26+
Use `peers_ids` to specify new peers of a cardinality many relationship.
2727
Only one of `attribute_value`, `peer_id` and `peers_ids` can be specified.
2828
"""
2929

tests/integration/test_convert_object_type.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
],
3737
"relationships": [
3838
{
39-
"name": "my_car",
39+
"name": "worst_car",
4040
"peer": "TestconvCar",
4141
"cardinality": "one",
4242
"identifier": "person__mandatory_owner",
@@ -98,3 +98,11 @@ async def test_convert_object_type(self, client, client_sync, client_type) -> No
9898
assert person_2.get_kind() == "TestconvPerson2"
9999
assert person_2.name.value == person_1.name.value
100100
assert person_2.age.value == new_age
101+
102+
# Fetch relationships of new node
103+
person_2 = await client.get(
104+
kind="TestconvPerson2", id=person_2.id, branch=client.default_branch, prefetch_relationships=True
105+
)
106+
assert person_2.worst_car.peer.id == car_1.id
107+
await person_2.fastest_cars.fetch()
108+
assert {related_node.peer.id for related_node in person_2.fastest_cars.peers} == {car_1.id}

0 commit comments

Comments
 (0)