Skip to content

Commit 2bc9526

Browse files
authored
Add delete organization method (#77)
1 parent 32a7844 commit 2bc9526

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

tests/test_organizations.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,3 +128,10 @@ def test_update_organization(self, mock_organization_updated, mock_request_metho
128128
"id": "org_domain_01EHT88Z8WZEFWYPM6EC9BX2R8",
129129
}
130130
]
131+
132+
def test_delete_organization(self, setup, mock_request_method):
133+
mock_response = Response()
134+
mock_response.status_code = 204
135+
mock_request_method("delete", mock_response, 204)
136+
response = self.organizations.delete_organization(organization="connection_id")
137+
assert response.status_code == 204

workos/organizations.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import workos
22
from workos.utils.request import (
33
RequestHelper,
4+
REQUEST_METHOD_DELETE,
45
REQUEST_METHOD_GET,
56
REQUEST_METHOD_POST,
67
REQUEST_METHOD_PUT,
@@ -101,3 +102,15 @@ def update_organization(self, organization, name, domains=None):
101102
params=params,
102103
token=workos.api_key,
103104
)
105+
106+
def delete_organization(self, organization):
107+
"""Deletes a single Organization
108+
109+
Args:
110+
organization (str): Organization unique identifier
111+
"""
112+
return self.request_helper.request(
113+
"organizations/{organization}".format(organization=organization),
114+
method=REQUEST_METHOD_DELETE,
115+
token=workos.api_key,
116+
)

0 commit comments

Comments
 (0)