summaryrefslogtreecommitdiff
path: root/tests/admin_scripts/tests.py
diff options
context:
space:
mode:
authorHasan Ramezani <hasan.r67@gmail.com>2018-08-18 23:57:39 +0430
committerTim Graham <timograham@gmail.com>2018-08-20 12:59:27 -0400
commit49b679371fe9beddcd23a93b5fdbadea914f37f8 (patch)
tree2d2461a9d632e45219daa220c98470fe96f8409b /tests/admin_scripts/tests.py
parentcfb4845f061ed6e81e9b5a1873d1c08d98c4b5a9 (diff)
Fixed #29236 -- Fixed diffsettings crash if using settings.configure().
Diffstat (limited to 'tests/admin_scripts/tests.py')
-rw-r--r--tests/admin_scripts/tests.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/tests/admin_scripts/tests.py b/tests/admin_scripts/tests.py
index 3c4e01dfac..c1d8baef6b 100644
--- a/tests/admin_scripts/tests.py
+++ b/tests/admin_scripts/tests.py
@@ -159,16 +159,18 @@ class AdminScriptTestCase(unittest.TestCase):
script_dir = os.path.abspath(os.path.join(os.path.dirname(django.__file__), 'bin'))
return self.run_test(os.path.join(script_dir, 'django-admin.py'), args, settings_file)
- def run_manage(self, args, settings_file=None):
+ def run_manage(self, args, settings_file=None, configured_settings=False):
def safe_remove(path):
try:
os.remove(path)
except OSError:
pass
- conf_dir = os.path.dirname(conf.__file__)
- template_manage_py = os.path.join(conf_dir, 'project_template', 'manage.py-tpl')
-
+ template_manage_py = (
+ os.path.join(os.path.dirname(__file__), 'configured_settings_manage.py')
+ if configured_settings else
+ os.path.join(os.path.dirname(conf.__file__), 'project_template', 'manage.py-tpl')
+ )
test_manage_py = os.path.join(self.test_dir, 'manage.py')
shutil.copyfile(template_manage_py, test_manage_py)
@@ -2182,6 +2184,11 @@ class DiffSettings(AdminScriptTestCase):
self.assertNoOutput(err)
self.assertOutput(out, "FOO = 'bar' ###")
+ def test_settings_configured(self):
+ out, err = self.run_manage(['diffsettings'], configured_settings=True)
+ self.assertNoOutput(err)
+ self.assertOutput(out, 'DEBUG = True')
+
def test_all(self):
"""The all option also shows settings with the default value."""
self.write_settings('settings_to_diff.py', sdict={'STATIC_URL': 'None'})