summaryrefslogtreecommitdiff
path: root/tests/regressiontests/admin_scripts/tests.py
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2012-02-07 18:46:29 +0000
committerAymeric Augustin <aymeric.augustin@m4x.org>2012-02-07 18:46:29 +0000
commit175e6d77df526dea1ade94661e487072e7c7cd88 (patch)
tree01c72a224ff47c1f2944612ad46381337d72eda2 /tests/regressiontests/admin_scripts/tests.py
parent09ad6d1b88381497493120c4be882175c11a4bc8 (diff)
Fixed #11745 -- Grouped commands by application in the output of `manage.py help`. Made 'version' consistent with 'help' while I was in the area, and added tests. Thanks Jannis for the feedback and review.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17462 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests/admin_scripts/tests.py')
-rw-r--r--tests/regressiontests/admin_scripts/tests.py44
1 files changed, 35 insertions, 9 deletions
diff --git a/tests/regressiontests/admin_scripts/tests.py b/tests/regressiontests/admin_scripts/tests.py
index e981f54c23..dd7e4b3d15 100644
--- a/tests/regressiontests/admin_scripts/tests.py
+++ b/tests/regressiontests/admin_scripts/tests.py
@@ -173,6 +173,10 @@ class AdminScriptTestCase(unittest.TestCase):
"Utility assertion: assert that the given message exists in the output"
self.assertTrue(msg in stream, "'%s' does not match actual output text '%s'" % (msg, stream))
+ def assertNotInOutput(self, stream, msg):
+ "Utility assertion: assert that the given message doesn't exist in the output"
+ self.assertFalse(msg in stream, "'%s' matches actual output text '%s'" % (msg, stream))
+
##########################################################################
# DJANGO ADMIN TESTS
# This first series of test classes checks the environment processing
@@ -1173,25 +1177,47 @@ class CommandTypes(AdminScriptTestCase):
self.remove_settings('settings.py')
def test_version(self):
- "--version is handled as a special case"
- args = ['--version']
+ "version is handled as a special case"
+ args = ['version']
out, err = self.run_manage(args)
self.assertNoOutput(err)
self.assertOutput(out, get_version())
+ def test_version_alternative(self):
+ "--version is equivalent to version"
+ args1, args2 = ['version'], ['--version']
+ self.assertEqual(self.run_manage(args1), self.run_manage(args2))
+
def test_help(self):
- "--help is handled as a special case"
- args = ['--help']
+ "help is handled as a special case"
+ args = ['help']
out, err = self.run_manage(args)
self.assertOutput(out, "Usage: manage.py subcommand [options] [args]")
self.assertOutput(out, "Type 'manage.py help <subcommand>' for help on a specific subcommand.")
+ self.assertOutput(out, '[django]')
+ self.assertOutput(out, 'startapp')
+ self.assertOutput(out, 'startproject')
- def test_short_help(self):
- "-h is handled as a short form of --help"
- args = ['-h']
+ def test_help_commands(self):
+ "help --commands shows the list of all available commands"
+ args = ['help', '--commands']
out, err = self.run_manage(args)
- self.assertOutput(out, "Usage: manage.py subcommand [options] [args]")
- self.assertOutput(out, "Type 'manage.py help <subcommand>' for help on a specific subcommand.")
+ self.assertNotInOutput(out, 'Usage:')
+ self.assertNotInOutput(out, 'Options:')
+ self.assertNotInOutput(out, '[django]')
+ self.assertOutput(out, 'startapp')
+ self.assertOutput(out, 'startproject')
+ self.assertNotInOutput(out, '\n\n')
+
+ def test_help_alternative(self):
+ "--help is equivalent to help"
+ args1, args2 = ['help'], ['--help']
+ self.assertEqual(self.run_manage(args1), self.run_manage(args2))
+
+ def test_help_short_altert(self):
+ "-h is handled as a short form of --help"
+ args1, args2 = ['--help'], ['-h']
+ self.assertEqual(self.run_manage(args1), self.run_manage(args2))
def test_specific_help(self):
"--help can be used on a specific command"