diff options
author | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2013-02-20 10:38:38 -0500 |
---|---|---|
committer | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2013-02-20 10:38:38 -0500 |
commit | 69ebf49d54aac70a42142d0d04e562496bce58ea (patch) | |
tree | ad0f346ff95a14ad49440128ff76d7e2b3f0816a /testsuite/Testsrc/Testlib/TestServer/TestPlugins | |
parent | 602ba6af6bd1c9b3910940dee766660ab8e81a19 (diff) | |
parent | e17e41dcff096ead7e129a0db063f75de44aaa2b (diff) | |
download | bcfg2-69ebf49d54aac70a42142d0d04e562496bce58ea.tar.gz bcfg2-69ebf49d54aac70a42142d0d04e562496bce58ea.tar.bz2 bcfg2-69ebf49d54aac70a42142d0d04e562496bce58ea.zip |
Merge branch 'master' into 1.4.x
Conflicts:
doc/appendix/contributors.txt
schemas/bundle.xsd
src/lib/Bcfg2/Client/Tools/__init__.py
src/lib/Bcfg2/Server/Encryption.py
src/lib/Bcfg2/Server/Lint/Genshi.py
src/lib/Bcfg2/Server/Plugins/Bundler.py
src/lib/Bcfg2/Server/Plugins/Decisions.py
src/lib/Bcfg2/Server/Plugins/TemplateHelper.py
src/sbin/bcfg2-test
testsuite/Testsrc/Testlib/TestClient/TestTools/TestPOSIX/Test__init.py
testsuite/Testsrc/Testlib/TestClient/TestTools/TestPOSIXUsers.py
testsuite/Testsrc/Testlib/TestServer/TestPlugin/Testhelpers.py
testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestProperties.py
tools/bcfg2-profile-templates.py
Diffstat (limited to 'testsuite/Testsrc/Testlib/TestServer/TestPlugins')
3 files changed, 18 insertions, 16 deletions
diff --git a/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestCfg/TestCfgExternalCommandVerifier.py b/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestCfg/TestCfgExternalCommandVerifier.py index 11dbdd391..0f369113b 100644 --- a/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestCfg/TestCfgExternalCommandVerifier.py +++ b/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestCfg/TestCfgExternalCommandVerifier.py @@ -26,7 +26,7 @@ class TestCfgExternalCommandVerifier(TestCfgVerifier): proc = Mock() mock_Popen.return_value = proc proc.wait.return_value = 0 - proc.communicate.return_value = MagicMock() + proc.communicate.return_value = ("stdout", "stderr") entry = lxml.etree.Element("Path", name="/test.txt") metadata = Mock() diff --git a/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestDefaults.py b/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestDefaults.py index 9ed0c3803..7be3d8e84 100644 --- a/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestDefaults.py +++ b/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestDefaults.py @@ -15,10 +15,10 @@ while path != "/": path = os.path.dirname(path) from common import * from TestRules import TestRules -from Testinterfaces import TestStructureValidator +from Testinterfaces import TestGoalValidator -class TestDefaults(TestRules, TestStructureValidator): +class TestDefaults(TestRules, TestGoalValidator): test_obj = Defaults def get_obj(self, *args, **kwargs): @@ -35,25 +35,22 @@ class TestDefaults(TestRules, TestStructureValidator): d.HandleEvent(evt) mock_HandleEvent.assert_called_with(d, evt) - def test_validate_structures(self): + def test_validate_goals(self): d = self.get_obj() d.BindEntry = Mock() metadata = Mock() entries = [] - b1 = lxml.etree.Element("Bundle") + config = lxml.etree.Element("Configuration") + b1 = lxml.etree.SubElement(config, "Bundle") entries.append(lxml.etree.SubElement(b1, "Path", name="/foo")) entries.append(lxml.etree.SubElement(b1, "Path", name="/bar")) - b2 = lxml.etree.Element("Bundle") - bound = lxml.etree.SubElement(b2, "BoundPath", name="/baz") - entries.append(bound) + b2 = lxml.etree.SubElement(config, "Bundle") entries.append(lxml.etree.SubElement(b2, "Package", name="quux")) - d.validate_structures(metadata, [b1, b2]) + d.validate_goals(metadata, config) self.assertItemsEqual(d.BindEntry.call_args_list, [call(e, metadata) for e in entries]) - # ensure that BoundEntries stay bound - self.assertTrue(bound.tag == "BoundPath") def test__matches_regex_disabled(self): """ cannot disable regex in Defaults plugin """ diff --git a/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestTemplateHelper.py b/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestTemplateHelper.py index 4db92b7c4..128d6cae5 100644 --- a/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestTemplateHelper.py +++ b/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestTemplateHelper.py @@ -39,7 +39,8 @@ class TestHelperModule(Bcfg2TestCase): mock_load_source.side_effect = ImportError attrs = dir(hm) hm.HandleEvent() - mock_load_source.assert_called_with(hm._module_name, hm.name) + mock_load_source.assert_called_with(safe_module_name(hm._module_name), + hm.name) self.assertEqual(attrs, dir(hm)) self.assertEqual(hm._attrs, []) @@ -50,7 +51,8 @@ class TestHelperModule(Bcfg2TestCase): mock_load_source.return_value = Mock() attrs = dir(hm) hm.HandleEvent() - mock_load_source.assert_called_with(hm._module_name, hm.name) + mock_load_source.assert_called_with(safe_module_name(hm._module_name), + hm.name) self.assertEqual(attrs, dir(hm)) self.assertEqual(hm._attrs, []) @@ -61,7 +63,8 @@ class TestHelperModule(Bcfg2TestCase): mock_load_source.return_value = module attrs = dir(hm) hm.HandleEvent() - mock_load_source.assert_called_with(hm._module_name, hm.name) + mock_load_source.assert_called_with(safe_module_name(hm._module_name), + hm.name) self.assertEqual(attrs, dir(hm)) self.assertEqual(hm._attrs, []) @@ -71,7 +74,8 @@ class TestHelperModule(Bcfg2TestCase): mock_load_source.reset() mock_load_source.return_value = module hm.HandleEvent() - mock_load_source.assert_called_with(hm._module_name, hm.name) + mock_load_source.assert_called_with(safe_module_name(hm._module_name), + hm.name) self.assertTrue(hasattr(hm, "foo")) self.assertTrue(hasattr(hm, "bar")) self.assertTrue(hasattr(hm, "baz")) @@ -83,7 +87,8 @@ class TestHelperModule(Bcfg2TestCase): mock_load_source.reset() mock_load_source.return_value = module hm.HandleEvent() - mock_load_source.assert_called_with(hm._module_name, hm.name) + mock_load_source.assert_called_with(safe_module_name(hm._module_name), + hm.name) self.assertTrue(hasattr(hm, "foo")) self.assertTrue(hasattr(hm, "bar")) self.assertTrue(hasattr(hm, "quux")) |