diff options
author | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2015-10-05 13:19:59 -0500 |
---|---|---|
committer | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2015-10-05 13:19:59 -0500 |
commit | 470723f1c9eabbeec63bba154e6d5c6dc75153ac (patch) | |
tree | 63c1e4b6b6a3e7b589bb4380d4a1bd073d94b519 /testsuite/Testsrc/Testlib/TestServer | |
parent | 35a2ad1d76790b62b3dbb41cb7fa112c81dc4d5f (diff) | |
parent | 3d2fca1e8573d60e67bb2fe642fb78c517d5ccc2 (diff) | |
download | bcfg2-470723f1c9eabbeec63bba154e6d5c6dc75153ac.tar.gz bcfg2-470723f1c9eabbeec63bba154e6d5c6dc75153ac.tar.bz2 bcfg2-470723f1c9eabbeec63bba154e6d5c6dc75153ac.zip |
Merge pull request #299 from AlexanderS/fix/caching
Expire metadata cache in all Connector plugins.
Diffstat (limited to 'testsuite/Testsrc/Testlib/TestServer')
-rw-r--r-- | testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestProperties.py | 15 | ||||
-rw-r--r-- | testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestTemplateHelper.py | 7 |
2 files changed, 17 insertions, 5 deletions
diff --git a/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestProperties.py b/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestProperties.py index 36baee899..8c7f3c5d7 100644 --- a/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestProperties.py +++ b/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestProperties.py @@ -29,11 +29,14 @@ class TestPropertyFile(Bcfg2TestCase): test_obj = PropertyFile path = os.path.join(datastore, "test") - def get_obj(self, path=None): + def get_obj(self, path=None, core=None, *args, **kwargs): set_setup_default("writes_enabled", False) if path is None: path = self.path - return self.test_obj(path) + if core is None: + core = Mock() + core.metadata_cache_mode = 'none' + return self.test_obj(path, core, *args, **kwargs) def test_write(self): pf = self.get_obj() @@ -97,6 +100,9 @@ class TestJSONPropertyFile(TestFileBacked, TestPropertyFile): TestFileBacked.setUp(self) TestPropertyFile.setUp(self) + def get_obj(self, *args, **kwargs): + return TestPropertyFile.get_obj(self, *args, **kwargs) + @patch("%s.loads" % JSON) def test_Index(self, mock_loads): pf = self.get_obj() @@ -137,6 +143,9 @@ class TestYAMLPropertyFile(TestFileBacked, TestPropertyFile): TestFileBacked.setUp(self) TestPropertyFile.setUp(self) + def get_obj(self, *args, **kwargs): + return TestPropertyFile.get_obj(self, *args, **kwargs) + @patch("yaml.load") def test_Index(self, mock_load): pf = self.get_obj() @@ -179,7 +188,7 @@ class TestXMLPropertyFile(TestPropertyFile, TestStructFile): set_setup_default("automatch", False) def get_obj(self, *args, **kwargs): - return TestStructFile.get_obj(self, *args, **kwargs) + return TestPropertyFile.get_obj(self, *args, **kwargs) @patch("%s.open" % builtins) def test__write(self, mock_open): diff --git a/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestTemplateHelper.py b/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestTemplateHelper.py index 1c2fa23a2..a470dca67 100644 --- a/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestTemplateHelper.py +++ b/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestTemplateHelper.py @@ -23,10 +23,13 @@ class TestHelperModule(Bcfg2TestCase): test_obj = HelperModule path = os.path.join(datastore, "test.py") - def get_obj(self, path=None): + def get_obj(self, path=None, core=None): if path is None: path = self.path - return self.test_obj(path) + if core is None: + core = Mock() + core.metadata_cache_mode = 'none' + return self.test_obj(path, core) def test__init(self): hm = self.get_obj() |