summaryrefslogtreecommitdiff
path: root/tests/check_framework/test_security.py
diff options
context:
space:
mode:
authorrroskam <rroskam@worthwhile.com>2015-06-16 16:08:03 -0400
committerTim Graham <timograham@gmail.com>2015-07-15 09:18:58 -0400
commited514caed20995814712fd6c9e9c4120b4ac64be (patch)
tree619d887d52cfd72f17e50aeb39c3d0fdd382f514 /tests/check_framework/test_security.py
parentc96f11257baf43188ff9daeddab3221992925c85 (diff)
Fixed #24966 -- Added deployment system check for empty ALLOWED_HOSTS.
Diffstat (limited to 'tests/check_framework/test_security.py')
-rw-r--r--tests/check_framework/test_security.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/check_framework/test_security.py b/tests/check_framework/test_security.py
index 42e186d639..adf1af952c 100644
--- a/tests/check_framework/test_security.py
+++ b/tests/check_framework/test_security.py
@@ -482,3 +482,18 @@ class CheckDebugTest(SimpleTestCase):
@override_settings(DEBUG=False)
def test_debug_false(self):
self.assertEqual(self.func(None), [])
+
+
+class CheckAllowedHostsTest(SimpleTestCase):
+ @property
+ def func(self):
+ from django.core.checks.security.base import check_allowed_hosts
+ return check_allowed_hosts
+
+ @override_settings(ALLOWED_HOSTS=[])
+ def test_allowed_hosts_empty(self):
+ self.assertEqual(self.func(None), [base.W020])
+
+ @override_settings(ALLOWED_HOSTS=['.example.com', ])
+ def test_allowed_hosts_set(self):
+ self.assertEqual(self.func(None), [])