Fixed a template lookup error

This commit is contained in:
Armin Ronacher 2010-07-06 19:24:50 +02:00
parent 596ae0ced5
commit 0a93c552cc
3 changed files with 26 additions and 11 deletions

View file

@ -21,6 +21,7 @@ from contextlib import contextmanager
from datetime import datetime
from werkzeug import parse_date, parse_options_header
from werkzeug.exceptions import NotFound
from jinja2 import TemplateNotFound
from cStringIO import StringIO
example_path = os.path.join(os.path.dirname(__file__), '..', 'examples')
@ -662,6 +663,17 @@ class ModuleTestCase(unittest.TestCase):
assert flask.url_for('admin.static', filename='test.txt') \
== '/admin/static/test.txt'
with app.test_request_context():
try:
flask.render_template('missing.html')
except TemplateNotFound, e:
assert e.name == 'missing.html'
else:
assert 0, 'expected exception'
with flask.Flask(__name__).test_request_context():
assert flask.render_template('nested/nested.txt') == 'I\'m nested'
def test_safe_access(self):
from moduleapp import app