From 9482a5637a4fe67f42783ebcad7c89ef413717a0 Mon Sep 17 00:00:00 2001 From: Michael Fenn Date: Thu, 25 Jul 2013 10:16:53 -0400 Subject: Adjust unit test --- testsuite/Testsrc/Testlib/TestClient/TestTools/TestPOSIX/Testbase.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'testsuite/Testsrc/Testlib') diff --git a/testsuite/Testsrc/Testlib/TestClient/TestTools/TestPOSIX/Testbase.py b/testsuite/Testsrc/Testlib/TestClient/TestTools/TestPOSIX/Testbase.py index e0406fd92..8e7b58d30 100644 --- a/testsuite/Testsrc/Testlib/TestClient/TestTools/TestPOSIX/Testbase.py +++ b/testsuite/Testsrc/Testlib/TestClient/TestTools/TestPOSIX/Testbase.py @@ -1009,7 +1009,7 @@ class TestPOSIXTool(TestTool): else: return True ptool._set_perms.side_effect = set_perms_rv - self.assertFalse(ptool._makedirs(entry)) + self.assertTrue(ptool._makedirs(entry)) self.assertItemsEqual(mock_exists.call_args_list, [call("/test"), call("/test/foo"), call("/test/foo/bar")]) -- cgit v1.2.3-1-g7c22 From 6c86b70c58d05bd6d1e6e9630d9490e36dccfe92 Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Mon, 5 Aug 2013 15:13:39 -0400 Subject: Probes: fixed unit test --- testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestProbes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'testsuite/Testsrc/Testlib') diff --git a/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestProbes.py b/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestProbes.py index 0794db62e..a87628eaf 100644 --- a/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestProbes.py +++ b/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestProbes.py @@ -466,7 +466,7 @@ text def test_load_data_db(self): probes = self.get_probes_object(use_db=True) probes.load_data() - probes._load_data_db.assert_any_call() + probes._load_data_db.assert_any_call(client=None) self.assertFalse(probes._load_data_xml.called) @patch("lxml.etree.parse") -- cgit v1.2.3-1-g7c22 From 27cdcd93023d5979d4c7724ca8c141331bae08e2 Mon Sep 17 00:00:00 2001 From: Michael Fenn Date: Mon, 5 Aug 2013 21:18:07 -0400 Subject: Adjust test Don't need to check write() because update_client() calls it --- testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestMetadata.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'testsuite/Testsrc/Testlib') diff --git a/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestMetadata.py b/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestMetadata.py index e2da6ec5d..1273f0d30 100644 --- a/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestMetadata.py +++ b/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestMetadata.py @@ -885,10 +885,10 @@ class TestMetadata(_TestMetadata, TestClientRunHooks, TestDatabaseBacked): metadata = self.load_clients_data(metadata=self.load_groups_data()) if not metadata._use_db: metadata.clients_xml.write = Mock() + metadata.set_profile("client1", "group2", None) mock_update_client.assert_called_with("client1", dict(profile="group2")) - metadata.clients_xml.write.assert_any_call() self.assertEqual(metadata.clientgroups["client1"], ["group2"]) metadata.clients_xml.write.reset_mock() -- cgit v1.2.3-1-g7c22 From 4bf1c82868357e5c357e0b656419af37a99a8545 Mon Sep 17 00:00:00 2001 From: Michael Fenn Date: Tue, 6 Aug 2013 16:01:12 -0400 Subject: Get profile by building metadata instead of guessing Rather than doing some ad-hoc lookups of internal data structures stpierre suggested that it'd be better to use the normal metadata build procedures. This implements that and adjusts the tests. --- testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestMetadata.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'testsuite/Testsrc/Testlib') diff --git a/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestMetadata.py b/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestMetadata.py index 1273f0d30..32c893548 100644 --- a/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestMetadata.py +++ b/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestMetadata.py @@ -885,6 +885,9 @@ class TestMetadata(_TestMetadata, TestClientRunHooks, TestDatabaseBacked): metadata = self.load_clients_data(metadata=self.load_groups_data()) if not metadata._use_db: metadata.clients_xml.write = Mock() + metadata.core.build_metadata = Mock() + metadata.core.build_metadata.side_effect = \ + lambda c: metadata.get_initial_metadata(c) metadata.set_profile("client1", "group2", None) mock_update_client.assert_called_with("client1", -- cgit v1.2.3-1-g7c22 From b5f384cef2ece8867e21098ef3773702e4d2be3b Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Wed, 7 Aug 2013 08:49:16 -0400 Subject: Plugin: fixed tests on Debuggable.set_debug --- testsuite/Testsrc/Testlib/TestServer/TestPlugin/Testbase.py | 5 ----- 1 file changed, 5 deletions(-) (limited to 'testsuite/Testsrc/Testlib') diff --git a/testsuite/Testsrc/Testlib/TestServer/TestPlugin/Testbase.py b/testsuite/Testsrc/Testlib/TestServer/TestPlugin/Testbase.py index e26c26d41..870983f60 100644 --- a/testsuite/Testsrc/Testlib/TestServer/TestPlugin/Testbase.py +++ b/testsuite/Testsrc/Testlib/TestServer/TestPlugin/Testbase.py @@ -29,16 +29,11 @@ class TestDebuggable(Bcfg2TestCase): def test_set_debug(self): d = self.get_obj() - d.debug_log = Mock() self.assertEqual(True, d.set_debug(True)) self.assertEqual(d.debug_flag, True) - self.assertTrue(d.debug_log.called) - - d.debug_log.reset_mock() self.assertEqual(False, d.set_debug(False)) self.assertEqual(d.debug_flag, False) - self.assertTrue(d.debug_log.called) def test_toggle_debug(self): d = self.get_obj() -- cgit v1.2.3-1-g7c22