From 8dbd71ef8e16ce64cfcf7c526d584ea2771a28d1 Mon Sep 17 00:00:00 2001 From: Armin Ronacher Date: Thu, 25 Aug 2011 20:48:38 +0100 Subject: [PATCH] Added a testcase where SERVER_NAME and APPLICATION_ROOT are not set --- tests/flask_tests.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/flask_tests.py b/tests/flask_tests.py index aa8f2cf3..040ddfaa 100644 --- a/tests/flask_tests.py +++ b/tests/flask_tests.py @@ -1057,6 +1057,19 @@ class TestToolsTestCase(FlaskTestCase): rv = c.get('/') self.assertEqual(rv.data, 'http://example.com:1234/foo/') + def test_environ_defaults(self): + app = flask.Flask(__name__) + app.testing = True + @app.route('/') + def index(): + return flask.request.url + + ctx = app.test_request_context() + self.assertEqual(ctx.request.url, 'http://localhost/') + with app.test_client() as c: + rv = c.get('/') + self.assertEqual(rv.data, 'http://localhost/') + def test_session_transactions(self): app = flask.Flask(__name__) app.testing = True