diff options
| author | Alex Tomic <atomic777@gmail.com> | 2018-03-02 12:25:08 -0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2018-03-02 12:25:08 -0500 |
| commit | a1a3e515616da102fc48a1e1af8a5b2f429f747e (patch) | |
| tree | 9b4d8d0fc4de50f09aa6be39a4ed00842a5ce2bb /tests/user_commands/tests.py | |
| parent | 40bac28faabbacd0875e59455cd80fb1dbb16966 (diff) | |
Fixed #29133 -- Fixed call_command() crash if a required option is passed in options.
Diffstat (limited to 'tests/user_commands/tests.py')
| -rw-r--r-- | tests/user_commands/tests.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/user_commands/tests.py b/tests/user_commands/tests.py index 3900a58247..ae05bcfe25 100644 --- a/tests/user_commands/tests.py +++ b/tests/user_commands/tests.py @@ -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): """ |
