def test_run_plugin(self): operation = '[{"dummy-action": {"pipeline": {"name": "NAME"}}}]' settings = JsonSettings(operation, {}) settings.register_plugin(DummyPluginModule) go = StubGo() settings.server_operations(go) func = DummyPluginFunction() self.assertEqual(1, len(func.call_log)) # No positional args args = func.call_log[0][0] self.assertEqual(args, ()) kwargs = func.call_log[0][1] self.assertEqual(kwargs['go'].get_pipeline_instance, go.get_pipeline_instance) self.assertEqual(settings.pipeline_names, ['NAME'])
def test_register_plugin(self): settings = JsonSettings("[]", {}) settings.register_plugin(DummyPluginModule) self.assertIn('dummy-action', settings.action_plugins) self.assertIsInstance(settings.action_plugins['dummy-action'], DummyPluginFunction)