Loading tests/admin_scripts/management/commands/color_command.py 0 → 100644 +9 −0 Original line number Diff line number Diff line from django.core.management.base import NoArgsCommand class Command(NoArgsCommand): help = "Test color output" requires_model_validation = False def handle_noargs(self, **options): return self.style.SQL_KEYWORD('BEGIN') tests/admin_scripts/tests.py +7 −11 Original line number Diff line number Diff line Loading @@ -1282,17 +1282,13 @@ class CommandTypes(AdminScriptTestCase): def test_no_color(self): "--no-color prevent colorization of the output" out = StringIO() call_command("sqlall", "admin_scripts", no_color=True, stdout=out) self.assertEqual(out.getvalue(), """BEGIN; CREATE TABLE "admin_scripts_article" ( "id" integer NOT NULL PRIMARY KEY, "headline" varchar(100) NOT NULL, "pub_date" datetime NOT NULL ) ; COMMIT; """) call_command('color_command', no_color=True, stdout=out) self.assertEqual(out.getvalue(), 'BEGIN\n') out = StringIO() call_command('color_command', stdout=out) self.assertEqual(out.getvalue(), '\x1b[33mBEGIN\x1b[0m\n') def test_base_command(self): "User BaseCommands can execute when a label is provided" Loading Loading
tests/admin_scripts/management/commands/color_command.py 0 → 100644 +9 −0 Original line number Diff line number Diff line from django.core.management.base import NoArgsCommand class Command(NoArgsCommand): help = "Test color output" requires_model_validation = False def handle_noargs(self, **options): return self.style.SQL_KEYWORD('BEGIN')
tests/admin_scripts/tests.py +7 −11 Original line number Diff line number Diff line Loading @@ -1282,17 +1282,13 @@ class CommandTypes(AdminScriptTestCase): def test_no_color(self): "--no-color prevent colorization of the output" out = StringIO() call_command("sqlall", "admin_scripts", no_color=True, stdout=out) self.assertEqual(out.getvalue(), """BEGIN; CREATE TABLE "admin_scripts_article" ( "id" integer NOT NULL PRIMARY KEY, "headline" varchar(100) NOT NULL, "pub_date" datetime NOT NULL ) ; COMMIT; """) call_command('color_command', no_color=True, stdout=out) self.assertEqual(out.getvalue(), 'BEGIN\n') out = StringIO() call_command('color_command', stdout=out) self.assertEqual(out.getvalue(), '\x1b[33mBEGIN\x1b[0m\n') def test_base_command(self): "User BaseCommands can execute when a label is provided" Loading