summaryrefslogtreecommitdiff
path: root/tests/admin_scripts
diff options
context:
space:
mode:
authorTom Forbes <tom@tomforb.es>2018-02-21 14:00:49 +0000
committerTim Graham <timograham@gmail.com>2018-02-21 09:00:49 -0500
commit33ac036a6bcab64ef93d0185f7b55eb57e559d6e (patch)
treea65c4d1618d3acb7ffbd4c2d312503305d6f4078 /tests/admin_scripts
parentf7b46f0b589fce13b5cb628cabb56900e2050dfe (diff)
downloaddjango-33ac036a6bcab64ef93d0185f7b55eb57e559d6e.tar.gz
Fixed #28398 -- Added suggestions for mistyped management commands.
Diffstat (limited to 'tests/admin_scripts')
-rw-r--r--tests/admin_scripts/tests.py20
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')