1
0
mirror of https://github.com/django/django.git synced 2024-12-22 17:16:24 +00:00

Refs #25264 -- Added test for command --help output with default options and custom arguments.

This commit is contained in:
Jan Szoja 2021-08-31 09:42:08 +02:00 committed by Mariusz Felisiak
parent 3cca5fdd3e
commit 97f377cd35

View File

@ -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!')