diff options
Diffstat (limited to 'testsuite')
4 files changed, 23 insertions, 7 deletions
diff --git a/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestBundler.py b/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestBundler.py index 1bf208c3e..5a8c44cd5 100644 --- a/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestBundler.py +++ b/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestBundler.py @@ -98,7 +98,7 @@ class TestBundler(TestPlugin, TestStructure, TestXMLDirectoryBacked): lxml.etree.SubElement(expected['indep'], "Service", name="baz") metadata = Mock() - metadata.bundles = ["error", "xinclude", "has_dep", "indep"] + metadata.bundles = set(["error", "xinclude", "has_dep", "indep"]) metadata.version_info = Bcfg2VersionInfo('1.4.0') rv = b.BuildStructures(metadata) @@ -131,7 +131,7 @@ class TestBundler(TestPlugin, TestStructure, TestXMLDirectoryBacked): lxml.etree.SubElement(expected['has_dep'], "Package", name="foo") metadata = Mock() - metadata.bundles = ["has_dep"] + metadata.bundles = set(["has_dep"]) metadata.version_info = Bcfg2VersionInfo('1.3.0') rv = b.BuildStructures(metadata) 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() diff --git a/testsuite/common.py b/testsuite/common.py index 45cfcbf0b..9f51cc14f 100644 --- a/testsuite/common.py +++ b/testsuite/common.py @@ -217,6 +217,10 @@ class DBModelTestCase(Bcfg2TestCase): """ Create the test database and sync the schema """ if self.models: import django.core.management + import django + if django.VERSION[0] == 1 and django.VERSION[1] >= 7: + django.setup() + django.core.management.call_command("syncdb", interactive=False, verbosity=0) self.assertTrue( |