From 93c9d7a7fd7f51f11bb11f65b74cb208f0c56c5a Mon Sep 17 00:00:00 2001 From: Blair Lunceford Date: Tue, 25 May 2021 13:22:30 -0600 Subject: [PATCH] Add delete organization method --- tests/test_organizations.py | 7 +++++++ workos/organizations.py | 13 +++++++++++++ 2 files changed, 20 insertions(+) diff --git a/tests/test_organizations.py b/tests/test_organizations.py index ecfa9fe2..601f23c1 100644 --- a/tests/test_organizations.py +++ b/tests/test_organizations.py @@ -128,3 +128,10 @@ def test_update_organization(self, mock_organization_updated, mock_request_metho "id": "org_domain_01EHT88Z8WZEFWYPM6EC9BX2R8", } ] + + def test_delete_organization(self, setup, mock_request_method): + mock_response = Response() + mock_response.status_code = 204 + mock_request_method("delete", mock_response, 204) + response = self.organizations.delete_organization(organization="connection_id") + assert response.status_code == 204 diff --git a/workos/organizations.py b/workos/organizations.py index 7c4555c1..f7ce3f32 100644 --- a/workos/organizations.py +++ b/workos/organizations.py @@ -1,6 +1,7 @@ import workos from workos.utils.request import ( RequestHelper, + REQUEST_METHOD_DELETE, REQUEST_METHOD_GET, REQUEST_METHOD_POST, REQUEST_METHOD_PUT, @@ -101,3 +102,15 @@ def update_organization(self, organization, name, domains=None): params=params, token=workos.api_key, ) + + def delete_organization(self, organization): + """Deletes a single Organization + + Args: + organization (str): Organization unique identifier + """ + return self.request_helper.request( + "organizations/{organization}".format(organization=organization), + method=REQUEST_METHOD_DELETE, + token=workos.api_key, + )