コード例 #1
0
class TestTemplatesPluginBasePath(Test):

    source_dir = 'test_plugin_jinja2_templates'

    def setup(self):
        super(TestTemplatesPluginBasePath, self).setup()
        self.site = Site(self.source_path, self.build_path, '/foo')
        templates_plugin = Jinja2TemplatesPlugin()
        self.site.add_plugin(templates_plugin)
        self.site.build()

    def test_var_base_path(self):
        with open(self.build_path + '/test_var_base_path.html') as f:
            assert f.read().strip() == '/foo'
コード例 #2
0
class TestTemplatesPluginUndefined(Test):

    source_dir = 'test_plugin_jinja2_templates_undefined'

    def setup(self):
        super(TestTemplatesPluginUndefined, self).setup()
        self.site = Site(self.source_path, self.build_path, '/foo')
        templates_plugin = Jinja2TemplatesPlugin()
        self.site.add_plugin(templates_plugin)

    def test_undefined(self):
        try:
            self.site.build()
        except UndefinedError:
            pass
        else:
            assert False, "Undefined variable raised no exception"
コード例 #3
0
 def setup(self):
     super(TestTemplatesPluginUndefined, self).setup()
     self.site = Site(self.source_path, self.build_path, '/foo')
     templates_plugin = Jinja2TemplatesPlugin()
     self.site.add_plugin(templates_plugin)