Skip to content
Myr

Enhance code coverage for Blueprint.endpoint

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

Add basic test for the endpoint decorator for the Blueprint object.

authored by Randy Liou · committed by Randy Liou · parent e048aa4 · Browse files · 1 file+19 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

1 file+19 added−0 removed

  • tests:+19 added−0 removed

1 file+19 added−0 removed

modified:tests/test_blueprints.py+19 added
353 unmodified lines
354 assert rv.status_code == 404355 rv = c.get('/py/bar/123')356 assert rv.status_code == 404357358359def test_endpoint_decorator():360 from werkzeug.routing import Rule361 app = flask.Flask(__name__)362 app.url_map.add(Rule('/foo', endpoint='bar'))363364 bp = flask.Blueprint('bp', __name__)365366 @bp.endpoint('bar')367 def foobar():368 return flask.request.endpoint369370 app.register_blueprint(bp, url_prefix='/bp_prefix')371372 c = app.test_client()373 assert c.get('/foo').data == b'bar'374 assert c.get('/bp_prefix/bar').status_code == 404375376377def test_template_filter():378 bp = flask.Blueprint('bp', __name__)379 @bp.app_template_filter()380 def my_reverse(s):
213 unmodified lines