-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add desktop_authenticators methods to client.Admin
Tested-by: new test case in tests/admin/test_desktop_authenticators.py
- Loading branch information
1 parent
eef3b40
commit 932c405
Showing
2 changed files
with
118 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
from .base import TestAdmin | ||
from .. import util | ||
|
||
|
||
class TestDesktopAuthenticators(TestAdmin): | ||
def test_get_desktop_authenticators_generator(self): | ||
""" Test to get desktop authenticators generator. | ||
""" | ||
generator = self.client_list.get_desktop_authenticators_generator() | ||
response = next(generator) | ||
uri, args = response['uri'].split('?') | ||
|
||
self.assertEqual(response['method'], 'GET') | ||
self.assertEqual(uri, '/admin/v1/desktop_authenticators') | ||
self.assertEqual(util.params_to_dict(args), | ||
{'account_id': [self.client_list.account_id], 'limit': ['100'], 'offset': ['0'], }) | ||
|
||
def test_get_desktop_authenticators(self): | ||
""" Test to get desktop authenticators without params. | ||
""" | ||
response = self.client_list.get_desktop_authenticators()[0] | ||
uri, args = response['uri'].split('?') | ||
|
||
self.assertEqual(response['method'], 'GET') | ||
self.assertEqual(uri, '/admin/v1/desktop_authenticators') | ||
self.assertEqual(util.params_to_dict(args), | ||
{'account_id': [self.client_list.account_id], 'limit': ['100'], 'offset': ['0'], }) | ||
|
||
def test_get_desktop_authenticators_limit(self): | ||
""" Test to get desktop authenticators with limit. | ||
""" | ||
response = self.client_list.get_desktop_authenticators(limit='20')[0] | ||
uri, args = response['uri'].split('?') | ||
|
||
self.assertEqual(response['method'], 'GET') | ||
self.assertEqual(uri, '/admin/v1/desktop_authenticators') | ||
self.assertEqual(util.params_to_dict(args), | ||
{'account_id': [self.client_list.account_id], 'limit': ['20'], 'offset': ['0'], }) | ||
|
||
def test_get_desktop_authenticators_offset(self): | ||
""" Test to get desktop authenticators with offset. | ||
""" | ||
response = self.client_list.get_desktop_authenticators(offset='20')[0] | ||
uri, args = response['uri'].split('?') | ||
|
||
self.assertEqual(response['method'], 'GET') | ||
self.assertEqual(uri, '/admin/v1/desktop_authenticators') | ||
self.assertEqual(util.params_to_dict(args), | ||
{'account_id': [self.client_list.account_id], 'limit': ['100'], 'offset': ['0'], }) | ||
|
||
def test_get_desktop_authenticators_limit_offset(self): | ||
""" Test to get desktop authenticators with limit and offset. | ||
""" | ||
response = self.client_list.get_desktop_authenticators(limit='20', offset='2')[0] | ||
uri, args = response['uri'].split('?') | ||
|
||
self.assertEqual(response['method'], 'GET') | ||
self.assertEqual(uri, '/admin/v1/desktop_authenticators') | ||
self.assertEqual(util.params_to_dict(args), | ||
{'account_id': [self.client_list.account_id], 'limit': ['20'], 'offset': ['2'], }) |