diff options
| author | Tim Graham <timograham@gmail.com> | 2013-06-09 15:07:23 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2013-06-09 15:08:29 -0400 |
| commit | 96c71d423db13825869a929b25d6b83dde67c170 (patch) | |
| tree | 3a96d633c0467071bf242ab15f0aa220f5a87c53 /tests/admin_scripts | |
| parent | 4e94c84e50b960405d5708d8d9528c44c7dabe83 (diff) | |
Added runserver validation to detect if DEBUG=False and ALLOWED_HOSTS is empty.
Refs #19875.
Diffstat (limited to 'tests/admin_scripts')
| -rw-r--r-- | tests/admin_scripts/tests.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/admin_scripts/tests.py b/tests/admin_scripts/tests.py index 9e6b1f557b..df8a8becf6 100644 --- a/tests/admin_scripts/tests.py +++ b/tests/admin_scripts/tests.py @@ -1192,6 +1192,21 @@ class ManageRunserver(AdminScriptTestCase): self.cmd.handle(addrport="deadbeef:7654") self.assertServerSettings('deadbeef', '7654') +class ManageRunserverEmptyAllowedHosts(AdminScriptTestCase): + def setUp(self): + self.write_settings('settings.py', sdict={ + 'ALLOWED_HOSTS': [], + 'DEBUG': False, + }) + + def tearDown(self): + self.remove_settings('settings.py') + + def test_empty_allowed_hosts_error(self): + out, err = self.run_manage(['runserver']) + self.assertNoOutput(out) + self.assertOutput(err, 'CommandError: You must set settings.ALLOWED_HOSTS if DEBUG is False.') + ########################################################################## # COMMAND PROCESSING TESTS |
