From 700cd04df55a2e4bcdbe58ebf670ec3e5ee45b18 Mon Sep 17 00:00:00 2001 From: Cheikh Gueye Wane Date: Wed, 26 Jun 2024 11:23:49 +0000 Subject: [PATCH] fix(Connections): use lowercase for identifier --- openhexa/sdk/workspaces/current_workspace.py | 2 +- tests/test_workspace.py | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/openhexa/sdk/workspaces/current_workspace.py b/openhexa/sdk/workspaces/current_workspace.py index 90b0e9d..73bf404 100644 --- a/openhexa/sdk/workspaces/current_workspace.py +++ b/openhexa/sdk/workspaces/current_workspace.py @@ -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: diff --git a/tests/test_workspace.py b/tests/test_workspace.py index d948f82..bdfb6f3 100644 --- a/tests/test_workspace.py +++ b/tests/test_workspace.py @@ -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 = {