mirror of
https://github.com/django/django.git
synced 2025-08-03 18:38:50 +00:00
Fixed #29133 -- Fixed call_command() crash if a required option is passed in options.
This commit is contained in:
parent
40bac28faa
commit
a1a3e51561
3 changed files with 31 additions and 1 deletions
|
@ -194,6 +194,18 @@ class CommandTests(SimpleTestCase):
|
|||
with self.assertRaisesMessage(TypeError, msg):
|
||||
management.call_command('dance', unrecognized=1, unrecognized2=1)
|
||||
|
||||
def test_call_command_with_required_parameters_in_options(self):
|
||||
out = StringIO()
|
||||
management.call_command('required_option', need_me='foo', needme2='bar', stdout=out)
|
||||
self.assertIn('need_me', out.getvalue())
|
||||
self.assertIn('needme2', out.getvalue())
|
||||
|
||||
def test_call_command_with_required_parameters_in_mixed_options(self):
|
||||
out = StringIO()
|
||||
management.call_command('required_option', '--need-me=foo', needme2='bar', stdout=out)
|
||||
self.assertIn('need_me', out.getvalue())
|
||||
self.assertIn('needme2', out.getvalue())
|
||||
|
||||
|
||||
class CommandRunTests(AdminScriptTestCase):
|
||||
"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue