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