-
Notifications
You must be signed in to change notification settings - Fork 151
Expand file tree
/
Copy pathtest_desktop_authenticators.py
More file actions
60 lines (49 loc) · 2.69 KB
/
test_desktop_authenticators.py
File metadata and controls
60 lines (49 loc) · 2.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
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'], })