Browse Source

Added failing test for plugin chaining

main
Lakshmi Vyasarajan 13 years ago
parent
commit
5598285c8d
1 changed files with 21 additions and 0 deletions
  1. +21
    -0
      hyde/tests/test_plugin.py

+ 21
- 0
hyde/tests/test_plugin.py View File

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

Loading…
Cancel
Save