PageRenderTime 82ms CodeModel.GetById 40ms app.highlight 3ms RepoModel.GetById 37ms app.codeStats 0ms

/tests/modeltests/user_commands/tests.py

https://code.google.com/p/mango-py/
Python | 21 lines | 17 code | 4 blank | 0 comment | 0 complexity | a74dc68eedc81e59a90f9309f837c570 MD5 | raw file
 1from StringIO import StringIO
 2
 3from django.test import TestCase
 4from django.core import management
 5from django.core.management.base import CommandError
 6
 7class CommandTests(TestCase):
 8    def test_command(self):
 9        out = StringIO()
10        management.call_command('dance', stdout=out)
11        self.assertEqual(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.assertEqual(out.getvalue(),
18            "I don't feel like dancing Jive.")
19
20    def test_explode(self):
21        self.assertRaises(CommandError, management.call_command, ('explode',))