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_organizations.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,15 @@ def test_list_organizations(self, mock_organizations, mock_request_method):
assert response.status_code == 200
assert len(response.response_dict["data"]) == 2

def test_get_organization(self, mock_organization, mock_request_method):
mock_response = Response()
mock_response.status_code = 200
mock_response.response_dict = mock_organization
mock_request_method("get", mock_response, 200)
response = self.organizations.get_organization(organization="organization_id")
assert response.status_code == 200
assert response.response_dict == mock_organization

def test_create_organization(self, mock_organization, mock_request_method):
organization = {"domains": ["example.com"], "name": "Test Organization"}
mock_response = Response()
Expand Down
13 changes: 13 additions & 0 deletions workos/organizations.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,19 @@ def list_organizations(
token=workos.api_key,
)

def get_organization(self, organization):
"""Gets details for a single Organization
Args:
organization (str): Organization's unique identifier
Returns:
dict: Organization response from WorkOS
"""
return self.request_helper.request(
"organizations/{organization}".format(organization=organization),
method=REQUEST_METHOD_GET,
token=workos.api_key,
)

def create_organization(self, organization):
"""Create an organization

Expand Down