Added template tests and made config a true global
This commit is contained in:
parent
5e88c8184d
commit
f34c028125
5 changed files with 43 additions and 11 deletions
|
|
@ -37,6 +37,18 @@ class TemplatingTestCase(FlaskTestCase):
|
|||
rv = app.test_client().get('/')
|
||||
self.assert_equal(rv.data, '42')
|
||||
|
||||
def test_request_less_rendering(self):
|
||||
app = flask.Flask(__name__)
|
||||
app.config['WORLD_NAME'] = 'Special World'
|
||||
@app.context_processor
|
||||
def context_processor():
|
||||
return dict(foo=42)
|
||||
|
||||
with app.app_context():
|
||||
rv = flask.render_template_string('Hello {{ config.WORLD_NAME }} '
|
||||
'{{ foo }}')
|
||||
self.assert_equal(rv, 'Hello Special World 42')
|
||||
|
||||
def test_standard_context(self):
|
||||
app = flask.Flask(__name__)
|
||||
app.secret_key = 'development key'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue