diff options
author | Chris Lamb <chris@chris-lamb.co.uk> | 2017-03-08 08:54:17 +0000 |
---|---|---|
committer | Tim Graham <timograham@gmail.com> | 2017-05-27 09:00:06 -0400 |
commit | 2f09a285582cb475a9d27067808d9beefa7f9fba (patch) | |
tree | a53b600fa4f242dcb9626c12535b19bb50d46e37 /tests/admin_scripts | |
parent | af1fa5e7da21c57a4037e67f93493af4e78d454a (diff) | |
download | django-2f09a285582cb475a9d27067808d9beefa7f9fba.tar.gz |
Fixed #27881 -- Added diffsettings --output option.
Thanks Haris Ibrahim K. V. for writng docs.
Diffstat (limited to 'tests/admin_scripts')
-rw-r--r-- | tests/admin_scripts/tests.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/admin_scripts/tests.py b/tests/admin_scripts/tests.py index fa7f9e060e..f52eac6761 100644 --- a/tests/admin_scripts/tests.py +++ b/tests/admin_scripts/tests.py @@ -2120,6 +2120,32 @@ class DiffSettings(AdminScriptTestCase): self.assertNotInOutput(out, "FOO") self.assertOutput(out, "BAR = 'bar2'") + def test_unified(self): + """--output=unified emits settings diff in unified mode.""" + self.write_settings('settings_to_diff.py', sdict={'FOO': '"bar"'}) + self.addCleanup(self.remove_settings, 'settings_to_diff.py') + args = ['diffsettings', '--settings=settings_to_diff', '--output=unified'] + out, err = self.run_manage(args) + self.assertNoOutput(err) + self.assertOutput(out, "+ FOO = 'bar'") + self.assertOutput(out, "- SECRET_KEY = ''") + self.assertOutput(out, "+ SECRET_KEY = 'django_tests_secret_key'") + self.assertNotInOutput(out, " APPEND_SLASH = True") + + def test_unified_all(self): + """ + --output=unified --all emits settings diff in unified mode and includes + settings with the default value. + """ + self.write_settings('settings_to_diff.py', sdict={'FOO': '"bar"'}) + self.addCleanup(self.remove_settings, 'settings_to_diff.py') + args = ['diffsettings', '--settings=settings_to_diff', '--output=unified', '--all'] + out, err = self.run_manage(args) + self.assertNoOutput(err) + self.assertOutput(out, " APPEND_SLASH = True") + self.assertOutput(out, "+ FOO = 'bar'") + self.assertOutput(out, "- SECRET_KEY = ''") + class Dumpdata(AdminScriptTestCase): """Tests for dumpdata management command.""" |