]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/pybind/mgr/dashboard/tests/test_rgw_client.py
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / pybind / mgr / dashboard / tests / test_rgw_client.py
index 8bdb01a1b5c379c6ef9fe76bb44d8ba409c3e106..e9e02c6dc37c6414c6ab28803b70d3f8e49f44e5 100644 (file)
@@ -3,31 +3,19 @@ import unittest
 
 from .. import mgr
 from ..services.rgw_client import RgwClient
+from . import KVStoreMockMixin
 
 
-class RgwClientTest(unittest.TestCase):
-    settings = {
-        'RGW_API_ACCESS_KEY': 'klausmustermann',
-        'RGW_API_SECRET_KEY': 'supergeheim',
-        'RGW_API_HOST': 'localhost',
-        'RGW_API_USER_ID': 'rgwadmin'
-    }
-
-    @classmethod
-    def mock_set_module_option(cls, key, val):
-        cls.settings[key] = val
-
-    @classmethod
-    def mock_get_module_option(cls, key, default):
-        return cls.settings.get(key, default)
-
-    @classmethod
-    def setUpClass(cls):
-        mgr.get_module_option.side_effect = cls.mock_get_module_option
-        mgr.set_module_option.side_effect = cls.mock_set_module_option
-
+class RgwClientTest(unittest.TestCase, KVStoreMockMixin):
     def setUp(self):
         RgwClient._user_instances.clear()  # pylint: disable=protected-access
+        self.mock_kv_store()
+        self.CONFIG_KEY_DICT.update({
+            'RGW_API_ACCESS_KEY': 'klausmustermann',
+            'RGW_API_SECRET_KEY': 'supergeheim',
+            'RGW_API_HOST': 'localhost',
+            'RGW_API_USER_ID': 'rgwadmin'
+        })
 
     def test_ssl_verify(self):
         mgr.set_module_option('RGW_API_SSL_VERIFY', True)