From 39a17b4058cc7ac1f646964f02dd7d48ff085c96 Mon Sep 17 00:00:00 2001 From: Taylor Hodge Date: Wed, 27 Jan 2021 15:45:20 -0500 Subject: [PATCH 1/2] add get connections/:id --- tests/test_sso.py | 10 ++++++++++ workos/sso.py | 17 ++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/tests/test_sso.py b/tests/test_sso.py index 7fd62921..697632ee 100644 --- a/tests/test_sso.py +++ b/tests/test_sso.py @@ -208,6 +208,16 @@ def test_create_connection(self, mock_request_method, mock_connection): connection = self.sso.create_connection("draft_conn_id") assert connection == response_dict + def test_get_connection(self, mock_connection, mock_request_method): + mock_response = Response() + mock_response.status_code = 200 + mock_response.response_dict = mock_connection + mock_request_method("get", mock_response, 200) + response = self.sso.get_connection(connection="connection_id") + assert response.status_code == 200 + assert response.response_dict == mock_connection + + def test_list_connections(self, mock_connections, mock_request_method): mock_response = Response() mock_response.status_code = 200 diff --git a/workos/sso.py b/workos/sso.py index b97dd2cc..ea1b5fd8 100644 --- a/workos/sso.py +++ b/workos/sso.py @@ -165,6 +165,21 @@ def create_connection(self, source): token=workos.api_key, ) + def get_connection(self, connection): + """Gets details for a single Connection + + Args: + connection (str): Connection unique identifier + + Returns: + dict: Connection response from WorkOS. + """ + return self.request_helper.request( + "connections/{connection}".format(connection=connection), + method=REQUEST_METHOD_GET, + token=workos.api_key, + ) + def list_connections( self, connection_type=None, @@ -186,7 +201,7 @@ def list_connections( dict: Connections response from WorkOS. """ params = { - "connetion_type": connection_type, + "connection_type": connection_type, "domain": domain, "limit": limit, "before": before, From 81f015c6e190d5287774a96cb66c2934bfb40702 Mon Sep 17 00:00:00 2001 From: Taylor Hodge Date: Wed, 27 Jan 2021 16:04:04 -0500 Subject: [PATCH 2/2] format --- tests/test_sso.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/test_sso.py b/tests/test_sso.py index 697632ee..26b85cbf 100644 --- a/tests/test_sso.py +++ b/tests/test_sso.py @@ -217,7 +217,6 @@ def test_get_connection(self, mock_connection, mock_request_method): assert response.status_code == 200 assert response.response_dict == mock_connection - def test_list_connections(self, mock_connections, mock_request_method): mock_response = Response() mock_response.status_code = 200