Skip to content

Commit d5445f8

Browse files
authored
Add DELETE /connections/:id (#53)
1 parent 07d9196 commit d5445f8

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

tests/test_sso.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,3 +225,10 @@ def test_list_connections(self, mock_connections, mock_request_method):
225225
response = self.sso.list_connections()
226226
assert response.status_code == 200
227227
assert response.response_dict == mock_connections
228+
229+
def test_delete_connection(self, mock_request_method):
230+
mock_response = Response()
231+
mock_response.status_code = 200
232+
mock_request_method("delete", mock_response, 200)
233+
response = self.sso.delete_connection(connection="connection_id")
234+
assert response.status_code == 200

workos/sso.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from workos.utils.request import (
1111
RequestHelper,
1212
RESPONSE_TYPE_CODE,
13+
REQUEST_METHOD_DELETE,
1314
REQUEST_METHOD_GET,
1415
REQUEST_METHOD_POST,
1516
)
@@ -213,3 +214,15 @@ def list_connections(
213214
params=params,
214215
token=workos.api_key,
215216
)
217+
218+
def delete_connection(self, connection):
219+
"""Deletes a single Connection
220+
221+
Args:
222+
connection (str): Connection unique identifier
223+
"""
224+
return self.request_helper.request(
225+
"connections/{connection}".format(connection=connection),
226+
method=REQUEST_METHOD_DELETE,
227+
token=workos.api_key,
228+
)

workos/utils/request.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
RESPONSE_TYPE_CODE = "code"
1616

17+
REQUEST_METHOD_DELETE = "delete"
1718
REQUEST_METHOD_GET = "get"
1819
REQUEST_METHOD_POST = "post"
1920

0 commit comments

Comments
 (0)