From 4affedec356ad8c9e6a107578f03fc7f5c615064 Mon Sep 17 00:00:00 2001 From: Armin Ronacher Date: Mon, 12 Apr 2010 20:39:52 +0200 Subject: [PATCH] Testing URL generation --- flask_tests.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/flask_tests.py b/flask_tests.py index 8308e19e..298f39b8 100644 --- a/flask_tests.py +++ b/flask_tests.py @@ -69,6 +69,14 @@ class ContextTestCase(unittest.TestCase): assert c.post('/set', data={'value': '42'}).data == 'value set' assert c.get('/get').data == '42' + def test_url_generation(self): + app = flask.Flask(__name__) + @app.route('/hello/', methods=['POST']) + def hello(): + pass + with app.test_request_context(): + assert flask.url_for('hello', name='test x') == '/hello/test%20x' + if __name__ == '__main__': unittest.main()