forked from orbit-oss/flask
added create_jinja_loader
This commit is contained in:
parent
b49de851d9
commit
00c5b7a937
3 changed files with 23 additions and 1 deletions
|
|
@ -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):
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue