PageRenderTime 16ms CodeModel.GetById 1ms RepoModel.GetById 0ms 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
Possible License(s): BSD-3-Clause
  1. from StringIO import StringIO
  2. from django.test import TestCase
  3. from django.core import management
  4. from django.core.management.base import CommandError
  5. class CommandTests(TestCase):
  6. def test_command(self):
  7. out = StringIO()
  8. management.call_command('dance', stdout=out)
  9. self.assertEqual(out.getvalue(),
  10. "I don't feel like dancing Rock'n'Roll.")
  11. def test_command_style(self):
  12. out = StringIO()
  13. management.call_command('dance', style='Jive', stdout=out)
  14. self.assertEqual(out.getvalue(),
  15. "I don't feel like dancing Jive.")
  16. def test_explode(self):
  17. self.assertRaises(CommandError, management.call_command, ('explode',))