Skip to content

Commit

Permalink
fix: isssues captured by the unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
doctrino committed Dec 5, 2023
1 parent a65c023 commit 92370b9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions cognite/client/data_classes/data_modeling/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,8 @@ def _load(cls, resource: dict[str, Any], cognite_client: CogniteClient | None =
)
if "direction" in resource:
instance.direction = resource["direction"]
if "connectionType" in resource:
instance.connection_type = resource["connectionType"]
return instance

def dump(self, camel_case: bool = True) -> dict[str, Any]:
Expand Down Expand Up @@ -456,6 +458,7 @@ def as_apply(self) -> SingleHopConnectionDefinitionApply:
description=self.description,
edge_source=self.edge_source,
direction=self.direction,
connection_type=self.connection_type,
)


Expand Down Expand Up @@ -557,6 +560,8 @@ def _load(cls, resource: dict[str, Any], cognite_client: CogniteClient | None =
)
if "direction" in resource:
instance.direction = resource["direction"]
if "connectionType" in resource:
instance.connection_type = resource["connectionType"]
return instance

def dump(self, camel_case: bool = True) -> dict:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def test_load_dumped_mapped_property_for_apply(self) -> None:

def test_load_dump_connection_property(self) -> None:
input = {
"connectionType": "multiEdgeConnection",
"connectionType": "multi_edge_connection",
"type": {"space": "mySpace", "externalId": "myExternalId"},
"source": {"type": "view", "space": "mySpace", "externalId": "myExternalId", "version": "myVersion"},
"direction": "outwards",
Expand All @@ -64,7 +64,7 @@ def test_load_dump_connection_property(self) -> None:
actual = ViewProperty.load(input)

assert actual.dump(camel_case=False) == {
"connection_type": "multiEdgeConnection",
"connection_type": "multi_edge_connection",
"description": None,
"direction": "outwards",
"edge_source": None,
Expand Down

0 comments on commit 92370b9

Please sign in to comment.