]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/pybind/mgr/dashboard/tests/test_cephfs.py
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / pybind / mgr / dashboard / tests / test_cephfs.py
index e9abda538090852197e61a1b9d6762d9608a6a71..5c35cab329cd6e980b120c6973ef70d07972cb55 100644 (file)
@@ -1,13 +1,13 @@
 # -*- coding: utf-8 -*-
 from collections import defaultdict
+
 try:
     from mock import Mock
 except ImportError:
-    from unittest.mock import Mock
+    from unittest.mock import patch, Mock
 
-from .. import mgr
-from . import ControllerTestCase
 from ..controllers.cephfs import CephFS
+from . import ControllerTestCase  # pylint: disable=no-name-in-module
 
 
 class MetaDataMock(object):
@@ -24,16 +24,10 @@ def get_metadata_mock(key, meta_key):
     }[key]
 
 
+@patch('dashboard.mgr.get_metadata', Mock(side_effect=get_metadata_mock))
 class CephFsTest(ControllerTestCase):
     cephFs = CephFS()
 
-    @classmethod
-    def setup_server(cls):
-        mgr.get_metadata = Mock(side_effect=get_metadata_mock)
-
-    def tearDown(self):
-        mgr.get_metadata.stop()
-
     def test_append_of_mds_metadata_if_key_is_not_found(self):
         mds_versions = defaultdict(list)
         # pylint: disable=protected-access