diff options
Diffstat (limited to 'testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestMetadata.py')
-rw-r--r-- | testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestMetadata.py | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestMetadata.py b/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestMetadata.py index f627e4465..69ea45de6 100644 --- a/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestMetadata.py +++ b/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestMetadata.py @@ -20,7 +20,7 @@ while path != "/": path = os.path.dirname(path) from common import * from TestPlugin import TestXMLFileBacked, TestMetadata as _TestMetadata, \ - TestStatistics, TestDatabaseBacked + TestClientRunHooks, TestDatabaseBacked def get_clients_test_tree(): @@ -198,6 +198,7 @@ if HAS_DJANGO or can_skip: class TestXMLMetadataConfig(TestXMLFileBacked): test_obj = XMLMetadataConfig + path = os.path.join(datastore, 'Metadata', 'clients.xml') def get_obj(self, basefile="clients.xml", core=None, watch_clients=False): self.metadata = get_metadata_object(core=core, @@ -326,7 +327,7 @@ class TestXMLMetadataConfig(TestXMLFileBacked): "clients.xml"), "<test/>") - @patch('Bcfg2.Server.Plugins.Metadata.locked', Mock(return_value=False)) + @patch('Bcfg2.Utils.locked', Mock(return_value=False)) @patch('fcntl.lockf', Mock()) @patch('os.open') @patch('os.fdopen') @@ -462,7 +463,7 @@ class TestClientMetadata(Bcfg2TestCase): self.assertFalse(cm.inGroup("group3")) -class TestMetadata(_TestMetadata, TestStatistics, TestDatabaseBacked): +class TestMetadata(_TestMetadata, TestClientRunHooks, TestDatabaseBacked): test_obj = Metadata use_db = False @@ -494,7 +495,7 @@ class TestMetadata(_TestMetadata, TestStatistics, TestDatabaseBacked): metadata = self.get_obj(core=core) self.assertIsInstance(metadata, Bcfg2.Server.Plugin.Plugin) self.assertIsInstance(metadata, Bcfg2.Server.Plugin.Metadata) - self.assertIsInstance(metadata, Bcfg2.Server.Plugin.Statistics) + self.assertIsInstance(metadata, Bcfg2.Server.Plugin.ClientRunHooks) self.assertIsInstance(metadata.clients_xml, XMLMetadataConfig) self.assertIsInstance(metadata.groups_xml, XMLMetadataConfig) self.assertIsInstance(metadata.query, MetadataQuery) @@ -1216,17 +1217,16 @@ class TestMetadata(_TestMetadata, TestStatistics, TestDatabaseBacked): @patch("Bcfg2.Server.Plugins.Metadata.XMLMetadataConfig.load_xml", Mock()) @patch("Bcfg2.Server.Plugins.Metadata.Metadata.update_client") - def test_process_statistics(self, mock_update_client): + def test_end_statistics(self, mock_update_client): metadata = self.load_clients_data(metadata=self.load_groups_data()) md = Mock() md.hostname = "client6" - metadata.process_statistics(md, None) - mock_update_client.assert_called_with(md.hostname, - dict(auth='cert')) + metadata.end_statistics(md) + mock_update_client.assert_called_with(md.hostname, dict(auth='cert')) mock_update_client.reset_mock() md.hostname = "client5" - metadata.process_statistics(md, None) + metadata.end_statistics(md) self.assertFalse(mock_update_client.called) def test_viz(self): @@ -1503,6 +1503,10 @@ class TestMetadata_NoClientsXML(TestMetadataBase): def test_handle_clients_xml_event(self): pass + def test_end_statistics(self): + # bootstrap mode, which is what is being tested here, doesn't + # work without clients.xml + pass class TestMetadata_ClientsXML(TestMetadataBase): """ test Metadata with a clients.xml. """ |