From 5598285c8dcd93d4a5088bdaa10d379be9ffe411 Mon Sep 17 00:00:00 2001 From: Lakshmi Vyasarajan Date: Wed, 11 May 2011 01:35:54 +0530 Subject: [PATCH] Added failing test for plugin chaining --- hyde/tests/test_plugin.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/hyde/tests/test_plugin.py b/hyde/tests/test_plugin.py index 7a136bf..c7739d9 100644 --- a/hyde/tests/test_plugin.py +++ b/hyde/tests/test_plugin.py @@ -19,6 +19,16 @@ TEST_SITE = File(__file__).parent.child_folder('_test') class PluginLoaderStub(Plugin): pass + +class NoReturnPlugin(Plugin): + + def begin_text_resource(self, resource, text): + return None + +class ConstantReturnPlugin(Plugin): + + def begin_text_resource(self, resource, text): + return "Jam" class TestPlugins(object): @@ -305,3 +315,14 @@ class TestPlugins(object): called_with_resources = sorted([arg[0][0].path for arg in begin_binary_resource_stub.call_args_list]) assert begin_binary_resource_stub.call_count == 1 assert called_with_resources[0] == path + + def test_plugin_chaining(self): + self.site.config.plugins = [ + 'hyde.tests.test_plugin.NoReturnPlugin', + 'hyde.tests.test_plugin.ConstantReturnPlugin'] + path = self.site.content.source_folder.child('about.html') + gen = Generator(self.site) + gen.generate_resource_at_path(path, incremental=True) + about = File(Folder( + self.site.config.deploy_root_path).child('about.html')) + assert about.read_all() == "Jam"