Skip to content
Myr

add tests for template_filter using a real template

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Sebastien Estienne · committed by Armin Ronacher · parent 5c9ef2c · Browse files · 2 files+24 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+24 added−0 removed

  • tests:+24 added−0 removed

2 files+24 added−0 removed

added:tests/templates/template_filter.html+1 added
modified:tests/flask_tests.py+23 added
327 unmodified lines
328 assert 'strrev' in app.jinja_env.filters.keys()329 assert app.jinja_env.filters['strrev'] == my_reverse330 assert app.jinja_env.filters['strrev']('abcd') == 'dcba'331332 def test_template_filter_with_template(self):333 app = flask.Flask(__name__)334 @app.template_filter()335 def super_reverse(s):336 return s[::-1]337 @app.route('/')338 def index():339 return flask.render_template('template_filter.html', value='abcd')340 rv = app.test_client().get('/')341 assert rv.data == 'dcba'342343 def test_template_filter_with_name_and_template(self):344 app = flask.Flask(__name__)345 @app.template_filter('super_reverse')346 def my_reverse(s):347 return s[::-1]348 @app.route('/')349 def index():350 return flask.render_template('template_filter.html', value='abcd')351 rv = app.test_client().get('/')352 assert rv.data == 'dcba'353354355def suite():356 from minitwit_tests import MiniTwitTestCase357 from flaskr_tests import FlaskrTestCase358 suite = unittest.TestSuite()
12 unmodified lines