Esempio n. 1
0
    def test_hooks(self):
        class plugin1:
            hooks = {"init": ["myclient"]}

        with unittest.mock.patch.object(plugins.Plugins,
                                        "iter_enabled",
                                        return_value=[("plugin1", plugin1)]):
            self.assertEqual([("plugin1", ["myclient"])],
                             list(plugins.iter_hooks({}, "init")))
Esempio n. 2
0
    def test_hooks(self) -> None:
        class plugin1:
            hooks = {"init": ["myclient"]}

        with patch.object(
                plugins.Plugins,
                "iter_enabled",
                return_value=[plugins.BasePlugin("plugin1", plugin1)],
        ):
            self.assertEqual([("plugin1", ["myclient"])],
                             list(plugins.iter_hooks({}, "init")))