summaryrefslogtreecommitdiff
path: root/tests/admin_scripts/tests.py
diff options
context:
space:
mode:
authororlnub123 <orlnub123@gmail.com>2019-02-22 21:36:11 +0300
committerTim Graham <timograham@gmail.com>2019-02-26 10:30:38 -0500
commit2c0fda7f206f2057df642939e51358944b313483 (patch)
tree14e66d273b09fdb13e8b98fd61c90d66e346c48a /tests/admin_scripts/tests.py
parent65ef5f467ba84c26392a157de1622d805401ec7d (diff)
Refs #30057 -- Added more diffsettings tests.
The test in 573f44d62fe1e87e2c20a74eba5e20ca9ff0ed85 doesn't act as a regression test.
Diffstat (limited to 'tests/admin_scripts/tests.py')
-rw-r--r--tests/admin_scripts/tests.py18
1 files changed, 14 insertions, 4 deletions
diff --git a/tests/admin_scripts/tests.py b/tests/admin_scripts/tests.py
index d48a0c8071..32233cf258 100644
--- a/tests/admin_scripts/tests.py
+++ b/tests/admin_scripts/tests.py
@@ -129,10 +129,10 @@ class AdminScriptTestCase(SimpleTestCase):
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, configured_settings=False):
+ def run_manage(self, args, settings_file=None, manage_py=None):
template_manage_py = (
- os.path.join(os.path.dirname(__file__), 'configured_settings_manage.py')
- if configured_settings else
+ os.path.join(os.path.dirname(__file__), manage_py)
+ if manage_py 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')
@@ -2139,11 +2139,21 @@ class DiffSettings(AdminScriptTestCase):
out, err = self.run_manage(args)
self.assertNoOutput(err)
self.assertOutput(out, "FOO = 'bar' ###")
+ # Attributes from django.conf.Settings don't appear.
+ self.assertNotInOutput(out, 'is_overridden = ')
def test_settings_configured(self):
- out, err = self.run_manage(['diffsettings'], configured_settings=True)
+ out, err = self.run_manage(['diffsettings'], manage_py='configured_settings_manage.py')
self.assertNoOutput(err)
self.assertOutput(out, 'CUSTOM = 1 ###\nDEBUG = True')
+ # Attributes from django.conf.UserSettingsHolder don't appear.
+ self.assertNotInOutput(out, 'default_settings = ')
+
+ def test_dynamic_settings_configured(self):
+ # Custom default settings appear.
+ out, err = self.run_manage(['diffsettings'], manage_py='configured_dynamic_settings_manage.py')
+ self.assertNoOutput(err)
+ self.assertOutput(out, "FOO = 'bar' ###")
def test_all(self):
"""The all option also shows settings with the default value."""