diff options
| author | Aymeric Augustin <aymeric.augustin@m4x.org> | 2011-10-18 16:42:32 +0000 |
|---|---|---|
| committer | Aymeric Augustin <aymeric.augustin@m4x.org> | 2011-10-18 16:42:32 +0000 |
| commit | 14d24eb438c9930ff76302f263d0f2a8b42d13c1 (patch) | |
| tree | 0685e3939c32c047650a6a248fdf174eb802e93f /tests | |
| parent | 396fcaaef92b6e5e56175b883c2cf6fcbda7ae97 (diff) | |
Fixed #17067 -- reverted some backwards-incompatible changes from r16933 and added tests.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17010 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/regressiontests/test_client_regress/models.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/regressiontests/test_client_regress/models.py b/tests/regressiontests/test_client_regress/models.py index 18ffffde1a..ff851971ff 100644 --- a/tests/regressiontests/test_client_regress/models.py +++ b/tests/regressiontests/test_client_regress/models.py @@ -994,3 +994,23 @@ class RequestFactoryStateTest(TestCase): def test_request_after_client_2(self): # This test is executed after the previous one self.common_test_that_should_always_pass() + + +class RequestFactoryEnvironmentTests(TestCase): + """ + Regression tests for #8551 and #17067: ensure that environment variables + are set correctly in RequestFactory. + """ + + def setUp(self): + self.factory = RequestFactory() + + def test_should_set_correct_env_variables(self): + request = self.factory.get('/path/') + + self.assertEqual(request.META.get('REMOTE_ADDR'), '127.0.0.1') + self.assertEqual(request.META.get('SERVER_NAME'), 'testserver') + self.assertEqual(request.META.get('SERVER_PORT'), '80') + self.assertEqual(request.META.get('SERVER_PROTOCOL'), 'HTTP/1.1') + self.assertEqual(request.META.get('SCRIPT_NAME') + + request.META.get('PATH_INFO'), '/path/') |
