Skip to content

Commit

Permalink
Ensure management key is set before passing through calls to manageme…
Browse files Browse the repository at this point in the history
…nt APIs (#90)
  • Loading branch information
shilgapira authored Nov 28, 2022
1 parent 6d4b1f4 commit b5f0184
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions descope/descope_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ def __init__(

@property
def mgmt(self):
if not self._auth.management_key:
raise AuthException(
400, ERROR_TYPE_INVALID_ARGUMENT, "management_key cannot be empty"
)
return self._mgmt

@property
Expand Down
4 changes: 4 additions & 0 deletions tests/test_descope_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ def test_descope_client(self):
DescopeClient(project_id="dummy", public_key=self.public_key_str)
)

def test_mgmt(self):
client = DescopeClient(self.dummy_project_id, self.public_key_dict)
self.assertRaises(AuthException, lambda: client.mgmt)

def test_logout(self):
dummy_refresh_token = ""
client = DescopeClient(self.dummy_project_id, self.public_key_dict)
Expand Down

0 comments on commit b5f0184

Please sign in to comment.