Skip to content

Commit

Permalink
Added call to regenerate workspace secrert key
Browse files Browse the repository at this point in the history
  • Loading branch information
mroloux committed Apr 27, 2020
1 parent 58492e3 commit b098e14
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 3 deletions.
4 changes: 4 additions & 0 deletions seatsio/workspaces/workspacesClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ def update(self, key, name):
self.http_client.url("/workspaces/{key}", key=key).post(
UpdateWorkspaceRequest(name))

def regenerate_secret_key(self, key):
response = self.http_client.url("/workspaces/{key}/actions/regenerate-secret-key", key=key).post()
return response.json()["secretKey"]

def retrieve(self, key):
return self.http_client.url("/workspaces/{key}", key=key).get_as(Workspace)

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setup(
name='seatsio',
version='v50.2.0',
version='v50.3.0',
description='The official Seats.io Python client library',
author='The seats.io dev team',
author_email='[email protected]',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from tests.util.asserts import assert_that


class RegenerateDesignerKeyTest(SeatsioClientTest):
class RegenerateSubaccountDesignerKeyTest(SeatsioClientTest):

def test(self):
subaccount = self.client.subaccounts.create()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from tests.util.asserts import assert_that


class RegenerateSecretKeyTest(SeatsioClientTest):
class RegenerateSubaccountSecretKeyTest(SeatsioClientTest):

def test(self):
subaccount = self.client.subaccounts.create()
Expand Down
14 changes: 14 additions & 0 deletions tests/workspaces/regenerateWorkspaceSecretKeyTest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from tests.seatsioClientTest import SeatsioClientTest
from tests.util.asserts import assert_that


class RegenerateWorkspaceSecretKeyTest(SeatsioClientTest):

def test(self):
workspace = self.client.workspaces.create("a ws")

new_secret_key = self.client.workspaces.regenerate_secret_key(workspace.key)

assert_that(new_secret_key).is_not_blank().is_not_equal_to(workspace.secret_key)
retrieved_workspace = self.client.workspaces.retrieve(workspace.key)
assert_that(retrieved_workspace.secret_key).is_equal_to(new_secret_key)

0 comments on commit b098e14

Please sign in to comment.