]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/pybind/mgr/dashboard/tests/test_rgw.py
update ceph source to reef 18.2.1
[ceph.git] / ceph / src / pybind / mgr / dashboard / tests / test_rgw.py
index 5c543cd817ad20c8a37396e7490a4d7af731aabe..bfb1dbc70355a0e4b765a7cd81e4317cbf6fabcc 100644 (file)
@@ -19,7 +19,9 @@ class RgwControllerTestCase(ControllerTestCase):
     @patch.object(RgwClient, '_get_user_id', Mock(return_value='fake-user'))
     @patch.object(RgwClient, 'is_service_online', Mock(return_value=True))
     @patch.object(RgwClient, '_is_system_user', Mock(return_value=True))
-    def test_status_available(self):
+    @patch('dashboard.services.ceph_service.CephService.send_command')
+    def test_status_available(self, send_command):
+        send_command.return_value = ''
         self._get('/test/ui-api/rgw/status')
         self.assertStatus(200)
         self.assertJsonBody({'available': True, 'message': None})
@@ -27,7 +29,9 @@ class RgwControllerTestCase(ControllerTestCase):
     @patch.object(RgwClient, '_get_user_id', Mock(return_value='fake-user'))
     @patch.object(RgwClient, 'is_service_online', Mock(
         side_effect=RequestException('My test error')))
-    def test_status_online_check_error(self):
+    @patch('dashboard.services.ceph_service.CephService.send_command')
+    def test_status_online_check_error(self, send_command):
+        send_command.return_value = ''
         self._get('/test/ui-api/rgw/status')
         self.assertStatus(200)
         self.assertJsonBody({'available': False,
@@ -35,7 +39,9 @@ class RgwControllerTestCase(ControllerTestCase):
 
     @patch.object(RgwClient, '_get_user_id', Mock(return_value='fake-user'))
     @patch.object(RgwClient, 'is_service_online', Mock(return_value=False))
-    def test_status_not_online(self):
+    @patch('dashboard.services.ceph_service.CephService.send_command')
+    def test_status_not_online(self, send_command):
+        send_command.return_value = ''
         self._get('/test/ui-api/rgw/status')
         self.assertStatus(200)
         self.assertJsonBody({'available': False,
@@ -44,7 +50,9 @@ class RgwControllerTestCase(ControllerTestCase):
     @patch.object(RgwClient, '_get_user_id', Mock(return_value='fake-user'))
     @patch.object(RgwClient, 'is_service_online', Mock(return_value=True))
     @patch.object(RgwClient, '_is_system_user', Mock(return_value=False))
-    def test_status_not_system_user(self):
+    @patch('dashboard.services.ceph_service.CephService.send_command')
+    def test_status_not_system_user(self, send_command):
+        send_command.return_value = ''
         self._get('/test/ui-api/rgw/status')
         self.assertStatus(200)
         self.assertJsonBody({'available': False,
@@ -64,7 +72,9 @@ class RgwDaemonControllerTestCase(ControllerTestCase):
 
     @patch('dashboard.services.rgw_client.RgwClient._get_user_id', Mock(
         return_value='dummy_admin'))
-    def test_list(self):
+    @patch('dashboard.services.ceph_service.CephService.send_command')
+    def test_list(self, send_command):
+        send_command.return_value = ''
         RgwStub.get_daemons()
         RgwStub.get_settings()
         mgr.list_servers.return_value = [{
@@ -86,7 +96,7 @@ class RgwDaemonControllerTestCase(ControllerTestCase):
                 'realm_name': 'realm2',
                 'zonegroup_name': 'zg2',
                 'zone_name': 'zone2',
-                'frontend_config#0': 'beast port=80'
+                'frontend_config#0': 'beast port=80 ssl_port=443 ssl_certificate=config:/config'
             }]
         self._get('/test/api/rgw/daemon')
         self.assertStatus(200)
@@ -159,7 +169,9 @@ class RgwUserControllerTestCase(ControllerTestCase):
         self.assertJsonBody(['test1', 'test2', 'test3', 'admin'])
 
     @patch('dashboard.controllers.rgw.RgwRESTController.proxy')
-    def test_user_list_duplicate_marker(self, mock_proxy):
+    @patch('dashboard.services.ceph_service.CephService.send_command')
+    def test_user_list_duplicate_marker(self, mock_proxy, send_command):
+        send_command.return_value = ''
         mock_proxy.side_effect = [{
             'count': 3,
             'keys': ['test1', 'test2', 'test3'],