diff options
| author | Jan Szoja <jszoja@gmail.com> | 2021-08-31 09:42:08 +0200 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2021-08-31 11:03:58 +0200 |
| commit | 97f377cd3520794f7d4e97b7aa1fa2093c426273 (patch) | |
| tree | 8af17260a48b542b2d0504e4fad30b461f3f015f /tests/admin_scripts/tests.py | |
| parent | 3cca5fdd3eb5906a385adaf9872581d4ed359041 (diff) | |
Refs #25264 -- Added test for command --help output with default options and custom arguments.
Diffstat (limited to 'tests/admin_scripts/tests.py')
| -rw-r--r-- | tests/admin_scripts/tests.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/admin_scripts/tests.py b/tests/admin_scripts/tests.py index e754989101..e5216e93e9 100644 --- a/tests/admin_scripts/tests.py +++ b/tests/admin_scripts/tests.py @@ -1496,6 +1496,31 @@ class CommandTypes(AdminScriptTestCase): self.assertLess(tag_location, version_location) self.assertOutput(out, "Checks the entire Django project for potential problems.") + def test_help_default_options_with_custom_arguments(self): + args = ['base_command', '--help'] + out, err = self.run_manage(args) + self.assertNoOutput(err) + expected_options = [ + '-h', + '--option_a OPTION_A', + '--option_b OPTION_B', + '--option_c OPTION_C', + '--version', + '-v {0,1,2,3}', + '--settings SETTINGS', + '--pythonpath PYTHONPATH', + '--traceback', + '--no-color', + '--force-color', + 'args ...', + ] + for option in expected_options: + self.assertOutput(out, f'[{option}]') + self.assertOutput(out, '--option_a OPTION_A, -a OPTION_A') + self.assertOutput(out, '--option_b OPTION_B, -b OPTION_B') + self.assertOutput(out, '--option_c OPTION_C, -c OPTION_C') + self.assertOutput(out, '-v {0,1,2,3}, --verbosity {0,1,2,3}') + def test_color_style(self): style = color.no_style() self.assertEqual(style.ERROR('Hello, world!'), 'Hello, world!') |
