parts/django/tests/modeltests/user_commands/tests.py
changeset 69 c6bca38c1cbf
equal deleted inserted replaced
68:5ff1fc726848 69:c6bca38c1cbf
       
     1 from StringIO import StringIO
       
     2 
       
     3 from django.test import TestCase
       
     4 from django.core import management
       
     5 from django.core.management.base import CommandError
       
     6 
       
     7 class CommandTests(TestCase):
       
     8     def test_command(self):
       
     9         out = StringIO()
       
    10         management.call_command('dance', stdout=out)
       
    11         self.assertEquals(out.getvalue(),
       
    12             "I don't feel like dancing Rock'n'Roll.")
       
    13 
       
    14     def test_command_style(self):
       
    15         out = StringIO()
       
    16         management.call_command('dance', style='Jive', stdout=out)
       
    17         self.assertEquals(out.getvalue(),
       
    18             "I don't feel like dancing Jive.")
       
    19 
       
    20     def test_explode(self):
       
    21         self.assertRaises(CommandError, management.call_command, ('explode',))