diff options
| author | Chris Lamb <chris@chris-lamb.co.uk> | 2017-02-25 02:58:56 +0800 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2017-02-24 13:58:56 -0500 |
| commit | 339d526d55baffea3bd3cecd0e07ddf644028e8c (patch) | |
| tree | 365441f9e3bf8b81e35a428c1c33809c86b1234b /tests | |
| parent | dc811cf50306972f838af8a975848ec26548bbf8 (diff) | |
Fixed #27873 -- Fixed crash in setup_test_environment() if ALLOWED_HOSTS is a tuple.
Regression in 17e661641ddaf8266e7430d83cfb2039abc55df7
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_utils/tests.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/test_utils/tests.py b/tests/test_utils/tests.py index 19ef405852..c37928bcaa 100644 --- a/tests/test_utils/tests.py +++ b/tests/test_utils/tests.py @@ -2,7 +2,9 @@ import os import sys import unittest from io import StringIO +from unittest import mock +from django.conf import settings from django.conf.urls import url from django.contrib.staticfiles.finders import get_finder, get_finders from django.contrib.staticfiles.storage import staticfiles_storage @@ -866,6 +868,16 @@ class SetupTestEnvironmentTests(SimpleTestCase): with self.assertRaisesMessage(RuntimeError, "setup_test_environment() was already called"): setup_test_environment() + def test_allowed_hosts(self): + for type_ in (list, tuple): + with self.subTest(type_=type_): + allowed_hosts = type_('*') + with mock.patch('django.test.utils._TestState') as x: + del x.saved_data + with self.settings(ALLOWED_HOSTS=allowed_hosts): + setup_test_environment() + self.assertEqual(settings.ALLOWED_HOSTS, ['*', 'testserver']) + class OverrideSettingsTests(SimpleTestCase): |
