Skip to content

Commit

Permalink
Add passwordless property to WorkOS client (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rohan Jadvani authored Oct 21, 2020
1 parent 4998fb9 commit 044a85a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
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._passwordless = None
client._portal = None
client._sso = None

Expand All @@ -21,6 +22,9 @@ def test_initialize_audit_log(self, set_api_key_and_project_id):
def test_initialize_directory_sync(self, set_api_key):
assert bool(client.directory_sync)

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

def test_initialize_portal(self, set_api_key):
assert bool(client.portal)

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

assert "api_key" in message

def test_initialize_passwordless_missing_api_key(self):
with pytest.raises(ConfigurationException) as ex:
client.passwordless

message = str(ex)

assert "api_key" in message

def test_initialize_portal_missing_api_key(self):
with pytest.raises(ConfigurationException) as ex:
client.portal
Expand Down
2 changes: 1 addition & 1 deletion workos/__about__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

__package_url__ = "https://github.com/workos-inc/workos-python"

__version__ = "0.8.0"
__version__ = "0.8.1"

__author__ = "WorkOS"

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.passwordless import Passwordless
from workos.portal import Portal
from workos.sso import SSO

Expand All @@ -25,6 +26,12 @@ def directory_sync(self):
self._directory_sync = DirectorySync()
return self._directory_sync

@property
def passwordless(self):
if not getattr(self, "_passwordless", None):
self._passwordless = Passwordless()
return self._passwordless

@property
def portal(self):
if not getattr(self, "_portal", None):
Expand Down

0 comments on commit 044a85a

Please sign in to comment.