diff options
author | Tom Forbes <tom@tomforb.es> | 2018-02-21 14:00:49 +0000 |
---|---|---|
committer | Tim Graham <timograham@gmail.com> | 2018-02-21 09:00:49 -0500 |
commit | 33ac036a6bcab64ef93d0185f7b55eb57e559d6e (patch) | |
tree | a65c4d1618d3acb7ffbd4c2d312503305d6f4078 /tests/admin_scripts | |
parent | f7b46f0b589fce13b5cb628cabb56900e2050dfe (diff) | |
download | django-33ac036a6bcab64ef93d0185f7b55eb57e559d6e.tar.gz |
Fixed #28398 -- Added suggestions for mistyped management commands.
Diffstat (limited to 'tests/admin_scripts')
-rw-r--r-- | tests/admin_scripts/tests.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/admin_scripts/tests.py b/tests/admin_scripts/tests.py index e9f5a1897b..d34f95ea40 100644 --- a/tests/admin_scripts/tests.py +++ b/tests/admin_scripts/tests.py @@ -2256,3 +2256,23 @@ class MainModule(AdminScriptTestCase): def test_program_name_in_help(self): out, err = self.run_test('-m', ['django', 'help']) self.assertOutput(out, "Type 'python -m django help <subcommand>' for help on a specific subcommand.") + + +class DjangoAdminSuggestions(AdminScriptTestCase): + def setUp(self): + self.write_settings('settings.py') + + def tearDown(self): + self.remove_settings('settings.py') + + def test_suggestions(self): + args = ['rnserver', '--settings=test_project.settings'] + out, err = self.run_django_admin(args) + self.assertNoOutput(out) + self.assertOutput(err, "Unknown command: 'rnserver'. Did you mean runserver?") + + def test_no_suggestions(self): + args = ['abcdef', '--settings=test_project.settings'] + out, err = self.run_django_admin(args) + self.assertNoOutput(out) + self.assertNotInOutput(err, 'Did you mean') |