Skip to content

Commit

Permalink
fix(Connections): use lowercase for identifier (#184)
Browse files Browse the repository at this point in the history
  • Loading branch information
cheikhgwane authored Jun 27, 2024
1 parent b48cb83 commit a864629
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion openhexa/sdk/workspaces/current_workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def get_connection(
}
}
""",
{"workspaceSlug": self.slug, "connectionSlug": identifier},
{"workspaceSlug": self.slug, "connectionSlug": identifier.lower()},
)
data = response["connectionBySlug"]
if data is None:
Expand Down
15 changes: 15 additions & 0 deletions tests/test_workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,21 @@ def test_workspace_get_connection_not_exist(self, workspace):
with pytest.raises(ValueError):
workspace.get_connection("random")

def test_workspace_get_connection_case_insensitive(self, workspace):
"""Test get connection."""
data = {
"connectionBySlug": {
"type": "CUSTOM",
"fields": [{"code": "field_1", "value": "field_1_value"}],
}
}
with mock.patch(
"openhexa.sdk.workspaces.current_workspace.graphql",
return_value=data,
):
connection = workspace.get_connection("RaNDom")
assert isinstance(connection, CustomConnection)

def test_workspace_get_connection(self, workspace):
"""Test get connection."""
data = {
Expand Down

0 comments on commit a864629

Please sign in to comment.