Skip to content
Myr

Add unittests for the endpoint decorator

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

authored by mvantellingen · committed by Armin Ronacher · parent 384ad21 · Browse files · 1 file+45 added−0 removed
This commit

State

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

Trailers

  • Signed-off-by: Armin Ronacher <armin.ronacher@active-4.com>

Diff stats

1 file+45 added−0 removed

  • tests:+45 added−0 removed

1 file+45 added−0 removed

modified:tests/flask_tests.py+45 added
222 unmodified lines
223 c = app.test_client()224 assert c.get('/foo/').data == 'index'225 assert c.get('/foo/bar').data == 'bar'226227 def test_endpoint_decorator(self):228 from werkzeug.routing import Submount, Rule229 app = flask.Flask(__name__)230 app.url_map.add(Submount('/foo', [231 Rule('/bar', endpoint='bar'),232 Rule('/', endpoint='index')233 ]))234235 @app.endpoint('bar')236 def bar():237 return 'bar'238239 @app.endpoint('index')240 def index():241 return 'index'242243 c = app.test_client()244 assert c.get('/foo/').data == 'index'245 assert c.get('/foo/bar').data == 'bar'246247 def test_session(self):248 app = flask.Flask(__name__)249 app.secret_key = 'testkey'250 @app.route('/set', methods=['POST'])
797 unmodified lines
1048 assert 0, 'expected exception'1049 finally:1050 os.path = old_path10511052 def test_endpoint_decorator(self):1053 from werkzeug.routing import Submount, Rule1054 from flask import Module10551056 app = flask.Flask(__name__)1057 app.url_map.add(Submount('/foo', [1058 Rule('/bar', endpoint='bar'),1059 Rule('/', endpoint='index')1060 ]))1061 module = Module(__name__, __name__)10621063 @module.endpoint('bar')1064 def bar():1065 return 'bar'10661067 @module.endpoint('index')1068 def index():1069 return 'index'10701071 app.register_module(module)10721073 c = app.test_client()1074 assert c.get('/foo/').data == 'index'1075 assert c.get('/foo/bar').data == 'bar'107610771078class SendfileTestCase(unittest.TestCase):10791080 def test_send_file_regular(self):1081 app = flask.Flask(__name__)
406 unmodified lines