Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions tests/test_sso.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,15 @@ 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
Expand Down
17 changes: 16 additions & 1 deletion workos/sso.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down