]>
git.proxmox.com Git - ceph.git/blob - ceph/src/pybind/mgr/dashboard/tests/test_rgw.py
3 from . import ControllerTestCase
4 from ..controllers
.rgw
import RgwUser
7 class RgwUserControllerTestCase(ControllerTestCase
):
10 RgwUser
._cp
_config
['tools.authenticate.on'] = False # pylint: disable=protected-access
11 cls
.setup_controllers([RgwUser
], '/test')
13 @mock.patch('dashboard.controllers.rgw.RgwRESTController.proxy')
14 def test_user_list(self
, mock_proxy
):
15 mock_proxy
.side_effect
= [{
17 'keys': ['test1', 'test2', 'test3'],
20 self
._get
('/test/api/rgw/user')
21 self
.assertStatus(200)
22 mock_proxy
.assert_has_calls([
23 mock
.call('GET', 'user?list', {})
25 self
.assertJsonBody(['test1', 'test2', 'test3'])
27 @mock.patch('dashboard.controllers.rgw.RgwRESTController.proxy')
28 def test_user_list_marker(self
, mock_proxy
):
29 mock_proxy
.side_effect
= [{
31 'keys': ['test1', 'test2', 'test3'],
39 self
._get
('/test/api/rgw/user')
40 self
.assertStatus(200)
41 mock_proxy
.assert_has_calls([
42 mock
.call('GET', 'user?list', {}),
43 mock
.call('GET', 'user?list', {'marker': 'foo:bar'})
45 self
.assertJsonBody(['test1', 'test2', 'test3', 'admin'])
47 @mock.patch('dashboard.controllers.rgw.RgwRESTController.proxy')
48 def test_user_list_duplicate_marker(self
, mock_proxy
):
49 mock_proxy
.side_effect
= [{
51 'keys': ['test1', 'test2', 'test3'],
56 'keys': ['test4', 'test5', 'test6'],
64 self
._get
('/test/api/rgw/user')
65 self
.assertStatus(500)
67 @mock.patch('dashboard.controllers.rgw.RgwRESTController.proxy')
68 def test_user_list_invalid_marker(self
, mock_proxy
):
69 mock_proxy
.side_effect
= [{
71 'keys': ['test1', 'test2', 'test3'],
76 'keys': ['test4', 'test5', 'test6'],
84 self
._get
('/test/api/rgw/user')
85 self
.assertStatus(500)