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')
 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')
 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
 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')
 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)
 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()
 def test_finalise(self):
     cpm = conncheck.ConnCheckPluginManager(
         module_source='a-source', tags='abc')
     cpm.finalise()
     self.mock_conncheck_manager.finalise.assert_called_once_with()
 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')
 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')
 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()