Fixed #28791 -- Allowed commands that don't require settings to work if the DJANGO_SETTINGS_MODULE doesn't exist.

This commit is contained in:
geekodour 2017-11-20 12:32:14 +05:30 committed by Tim Graham
parent 16bd4964df
commit c6864a01b2
2 changed files with 12 additions and 0 deletions

View file

@ -236,6 +236,16 @@ class DjangoAdminNoSettings(AdminScriptTestCase):
self.assertNoOutput(out)
self.assertOutput(err, "No module named '?bad_settings'?", regex=True)
def test_commands_with_invalid_settings(self):
""""
Commands that don't require settings succeed if the settings file
doesn't exist.
"""
args = ['startproject']
out, err = self.run_django_admin(args, settings_file='bad_settings')
self.assertNoOutput(out)
self.assertOutput(err, "You must provide a project name", regex=True)
class DjangoAdminDefaultSettings(AdminScriptTestCase):
"""A series of tests for django-admin.py when using a settings.py file that