Skip to content

Commit 07d9196

Browse files
authored
Add GET /connections/:id (#52)
1 parent 34f093d commit 07d9196

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

tests/test_sso.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,15 @@ def test_create_connection(self, mock_request_method, mock_connection):
208208
connection = self.sso.create_connection("draft_conn_id")
209209
assert connection == response_dict
210210

211+
def test_get_connection(self, mock_connection, mock_request_method):
212+
mock_response = Response()
213+
mock_response.status_code = 200
214+
mock_response.response_dict = mock_connection
215+
mock_request_method("get", mock_response, 200)
216+
response = self.sso.get_connection(connection="connection_id")
217+
assert response.status_code == 200
218+
assert response.response_dict == mock_connection
219+
211220
def test_list_connections(self, mock_connections, mock_request_method):
212221
mock_response = Response()
213222
mock_response.status_code = 200

workos/sso.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,21 @@ def create_connection(self, source):
165165
token=workos.api_key,
166166
)
167167

168+
def get_connection(self, connection):
169+
"""Gets details for a single Connection
170+
171+
Args:
172+
connection (str): Connection unique identifier
173+
174+
Returns:
175+
dict: Connection response from WorkOS.
176+
"""
177+
return self.request_helper.request(
178+
"connections/{connection}".format(connection=connection),
179+
method=REQUEST_METHOD_GET,
180+
token=workos.api_key,
181+
)
182+
168183
def list_connections(
169184
self,
170185
connection_type=None,
@@ -186,7 +201,7 @@ def list_connections(
186201
dict: Connections response from WorkOS.
187202
"""
188203
params = {
189-
"connetion_type": connection_type,
204+
"connection_type": connection_type,
190205
"domain": domain,
191206
"limit": limit,
192207
"before": before,

0 commit comments

Comments
 (0)