mirror of
https://github.com/django/django.git
synced 2025-07-19 03:05:32 +00:00
Fixed #29295 -- Fixed management command crash when using subparsers.
Thanks Tim Graham for the fix.
This commit is contained in:
parent
21420096c4
commit
dd68b51e1d
4 changed files with 32 additions and 7 deletions
|
@ -206,6 +206,16 @@ class CommandTests(SimpleTestCase):
|
|||
self.assertIn('need_me', out.getvalue())
|
||||
self.assertIn('needme2', out.getvalue())
|
||||
|
||||
def test_subparser(self):
|
||||
out = StringIO()
|
||||
management.call_command('subparser', 'foo', 12, stdout=out)
|
||||
self.assertIn('bar', out.getvalue())
|
||||
|
||||
def test_subparser_invalid_option(self):
|
||||
msg = "Error: invalid choice: 'test' (choose from 'foo')"
|
||||
with self.assertRaisesMessage(CommandError, msg):
|
||||
management.call_command('subparser', 'test', 12)
|
||||
|
||||
|
||||
class CommandRunTests(AdminScriptTestCase):
|
||||
"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue