From bd8496be408e5c341825a571e0930da2e841ea96 Mon Sep 17 00:00:00 2001 From: Rohan Jadvani Date: Tue, 20 Oct 2020 21:58:23 -0400 Subject: [PATCH] Add `passwordless` property to WorkOS client --- tests/test_client.py | 12 ++++++++++++ workos/__about__.py | 2 +- workos/client.py | 7 +++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/tests/test_client.py b/tests/test_client.py index cf5abb2c..63794a73 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -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 @@ -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) @@ -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 diff --git a/workos/__about__.py b/workos/__about__.py index 5af5b794..ee18a13e 100644 --- a/workos/__about__.py +++ b/workos/__about__.py @@ -12,7 +12,7 @@ __package_url__ = "https://github.com/workos-inc/workos-python" -__version__ = "0.8.0" +__version__ = "0.8.1" __author__ = "WorkOS" diff --git a/workos/client.py b/workos/client.py index 244d3ded..7391b6bf 100644 --- a/workos/client.py +++ b/workos/client.py @@ -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 @@ -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):