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
12 changes: 12 additions & 0 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class TestClient(object):
def setup(self):
client._audit_trail = None
client._directory_sync = None
client._organizations = None
client._passwordless = None
client._portal = None
client._sso = None
Expand All @@ -22,6 +23,9 @@ def test_initialize_audit_log(self, set_api_key):
def test_initialize_directory_sync(self, set_api_key):
assert bool(client.directory_sync)

def test_initialize_organizations(self, set_api_key):
assert bool(client.organizations)

def test_initialize_passwordless(self, set_api_key):
assert bool(client.passwordless)

Expand Down Expand Up @@ -70,6 +74,14 @@ def test_initialize_directory_sync_missing_api_key(self):

assert "api_key" in message

def test_initialize_organizations_missing_api_key(self):
with pytest.raises(ConfigurationException) as ex:
client.organizations

message = str(ex)

assert "api_key" in message

def test_initialize_passwordless_missing_api_key(self):
with pytest.raises(ConfigurationException) as ex:
client.passwordless
Expand Down
7 changes: 7 additions & 0 deletions workos/client.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from workos.audit_trail import AuditTrail
from workos.directory_sync import DirectorySync
from workos.organizations import Organizations
from workos.passwordless import Passwordless
from workos.portal import Portal
from workos.sso import SSO
Expand All @@ -26,6 +27,12 @@ def directory_sync(self):
self._directory_sync = DirectorySync()
return self._directory_sync

@property
def organizations(self):
if not getattr(self, "_organizations", None):
self._organizations = Organizations()
return self._organizations

@property
def passwordless(self):
if not getattr(self, "_passwordless", None):
Expand Down
2 changes: 1 addition & 1 deletion workos/utils/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
REQUIRED_SETTINGS_FOR_MODULE = {
AUDIT_TRAIL_MODULE: ["api_key",],
DIRECTORY_SYNC_MODULE: ["api_key",],
ORGANIZATIONS_MODULE: ["api_key"],
ORGANIZATIONS_MODULE: ["api_key",],
PASSWORDLESS_MODULE: ["api_key",],
PORTAL_MODULE: ["api_key",],
SSO_MODULE: ["api_key", "client_id",],
Expand Down