コード例 #1
0
    def test_init(self):
        cpm = conncheck.ConnCheckPluginManager()
        self.assertEqual(cpm.managed_name, 'DEFAULT')
        self.assertEqual(cpm._conncheck_manager, self.mock_conncheck_manager)

        cpm = conncheck.ConnCheckPluginManager(managed_name='a-manager')
        self.assertEqual(cpm.managed_name, 'a-manager')
コード例 #2
0
 def test_get_instance(self):
     cpm = conncheck.ConnCheckPluginManager(
         module_source='a-source', tags='abc')
     self.mock_conncheck_manager.get_instance.return_value = 'an-instance'
     self.assertEqual(cpm.get_instance('a-spec'), 'an-instance')
     self.mock_conncheck_manager.get_instance.assert_called_once_with(
         'a-spec')
コード例 #3
0
 def test_manager_property(self):
     cpm = conncheck.ConnCheckPluginManager(
         module_source='a-source', tags='abc')
     self.assertEqual(cpm.manager, self.mock_conncheck_manager)
     cpm._conncheck_manager = None
     with self.assertRaises(AssertionError):
         cpm.manager
コード例 #4
0
 def test_configure_plugin(self):
     cpm = conncheck.ConnCheckPluginManager(
         module_source='a-source', tags='abc')
     cpm.configure(collection_object=self.mock_collection_object)
     self.mock_conncheck_manager.configure.assert_called_once_with(
         collection='a-collection',
         logs_dir='a-logs-dir',
         module_source='a-source',
         tags='abc')
コード例 #5
0
 def test_reset(self):
     cpm = conncheck.ConnCheckPluginManager(
         module_source='a-source', tags='abc')
     cpm.reset()
     self.mock_conncheck_manager.clean_up.assert_called_once_with()
     self.assertIsNone(cpm._conncheck_manager)
コード例 #6
0
 def test_log_files(self):
     cpm = conncheck.ConnCheckPluginManager(
         module_source='a-source', tags='abc')
     cpm.log_files()
     self.mock_conncheck_manager.log_files.assert_called_once_with()
コード例 #7
0
 def test_finalise(self):
     cpm = conncheck.ConnCheckPluginManager(
         module_source='a-source', tags='abc')
     cpm.finalise()
     self.mock_conncheck_manager.finalise.assert_called_once_with()
コード例 #8
0
 def test_stop(self):
     cpm = conncheck.ConnCheckPluginManager(
         module_source='a-source', tags='abc')
     cpm.stop('a-spec')
     self.mock_conncheck_manager.stop.assert_called_once_with('a-spec')
コード例 #9
0
 def test_add_instance(self):
     cpm = conncheck.ConnCheckPluginManager(
         module_source='a-source', tags='abc')
     cpm.add_instance('a-spec', this='that')
     self.mock_conncheck_manager.add_instance.assert_called_once_with(
         'a-spec', this='that')
コード例 #10
0
 def test_configure(self):
     cpm = conncheck.ConnCheckPluginManager()
     self.patch_object(
         cpm, 'configure_plugin', name='mock_cpm_configure_plugin')
     cpm.configure(collection_object=self.mock_collection_object)
     self.mock_cpm_configure_plugin.assert_called_once_with()