mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
Fixed #35689 -- Handled custom labels in LabelCommand.missing_args_message.
This commit is contained in:
committed by
Sarah Boyce
parent
47b921391f
commit
f72bbd4480
@@ -25,6 +25,7 @@ from django.core.management import (
|
||||
color,
|
||||
execute_from_command_line,
|
||||
)
|
||||
from django.core.management.base import LabelCommand
|
||||
from django.core.management.commands.loaddata import Command as LoaddataCommand
|
||||
from django.core.management.commands.runserver import Command as RunserverCommand
|
||||
from django.core.management.commands.testserver import Command as TestserverCommand
|
||||
@@ -2280,6 +2281,20 @@ class CommandTypes(AdminScriptTestCase):
|
||||
"('settings', None), ('traceback', False), ('verbosity', 1)]",
|
||||
)
|
||||
|
||||
def test_custom_label_command_custom_missing_args_message(self):
|
||||
class Command(LabelCommand):
|
||||
missing_args_message = "Missing argument."
|
||||
|
||||
with self.assertRaisesMessage(CommandError, "Error: Missing argument."):
|
||||
call_command(Command())
|
||||
|
||||
def test_custom_label_command_none_missing_args_message(self):
|
||||
class Command(LabelCommand):
|
||||
missing_args_message = None
|
||||
|
||||
with self.assertRaisesMessage(CommandError, ""):
|
||||
call_command(Command())
|
||||
|
||||
def test_suppress_base_options_command_help(self):
|
||||
args = ["suppress_base_options_command", "--help"]
|
||||
out, err = self.run_manage(args)
|
||||
|
||||
Reference in New Issue
Block a user