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")))
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")))