Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed a test that depended on the DB backend; refs #19877. Thanks Loic.

  • Loading branch information...
commit dffda2ba4e55d4567b3a829d410dae794636ebdd 1 parent 5b47a9c
Tim Graham authored July 30, 2013
9  tests/admin_scripts/management/commands/color_command.py
... ...
@@ -0,0 +1,9 @@
  1
+from django.core.management.base import NoArgsCommand
  2
+
  3
+
  4
+class Command(NoArgsCommand):
  5
+    help = "Test color output"
  6
+    requires_model_validation = False
  7
+
  8
+    def handle_noargs(self, **options):
  9
+        return self.style.SQL_KEYWORD('BEGIN')
18  tests/admin_scripts/tests.py
@@ -1282,17 +1282,13 @@ def test_specific_help(self):
1282 1282
     def test_no_color(self):
1283 1283
         "--no-color prevent colorization of the output"
1284 1284
         out = StringIO()
1285  
-        call_command("sqlall", "admin_scripts", no_color=True, stdout=out)
1286  
-        self.assertEqual(out.getvalue(), """BEGIN;
1287  
-CREATE TABLE "admin_scripts_article" (
1288  
-    "id" integer NOT NULL PRIMARY KEY,
1289  
-    "headline" varchar(100) NOT NULL,
1290  
-    "pub_date" datetime NOT NULL
1291  
-)
1292  
-;
1293  
-
1294  
-COMMIT;
1295  
-""")
  1285
+
  1286
+        call_command('color_command', no_color=True, stdout=out)
  1287
+        self.assertEqual(out.getvalue(), 'BEGIN\n')
  1288
+
  1289
+        out = StringIO()
  1290
+        call_command('color_command', stdout=out)
  1291
+        self.assertEqual(out.getvalue(), '\x1b[33mBEGIN\x1b[0m\n')
1296 1292
 
1297 1293
     def test_base_command(self):
1298 1294
         "User BaseCommands can execute when a label is provided"

0 notes on commit dffda2b

Please sign in to comment.
Something went wrong with that request. Please try again.