added create_jinja_loader

This commit is contained in:
Armin Ronacher 2011-02-21 21:56:37 +01:00
parent b49de851d9
commit 00c5b7a937
3 changed files with 23 additions and 1 deletions

View file

@ -857,6 +857,19 @@ class TemplatingTestCase(unittest.TestCase):
rv = app.test_client().get('/')
assert rv.data == 'dcba'
def test_custom_template_loader(self):
class MyFlask(flask.Flask):
def create_jinja_loader(self):
from jinja2 import DictLoader
return DictLoader({'index.html': 'Hello Custom World!'})
app = MyFlask(__name__)
@app.route('/')
def index():
return flask.render_template('index.html')
c = app.test_client()
rv = c.get('/')
assert rv.data == 'Hello Custom World!'
class ModuleTestCase(unittest.TestCase):