1
0
mirror of https://github.com/django/django.git synced 2025-10-23 21:59:11 +00:00

Used assertRaisesMessage() to test Django's error messages.

This commit is contained in:
Mads Jensen
2017-05-28 21:37:21 +02:00
committed by Tim Graham
parent 38988f289f
commit a51c4de194
69 changed files with 448 additions and 173 deletions

View File

@@ -46,7 +46,7 @@ class CommandTests(SimpleTestCase):
def test_explode(self):
""" An unknown command raises CommandError """
with self.assertRaises(CommandError):
with self.assertRaisesMessage(CommandError, "Unknown command: 'explode'"):
management.call_command(('explode',))
def test_system_exit(self):
@@ -215,5 +215,6 @@ class CommandRunTests(AdminScriptTestCase):
class UtilsTests(SimpleTestCase):
def test_no_existent_external_program(self):
with self.assertRaises(CommandError):
msg = 'Error executing a_42_command_that_doesnt_exist_42'
with self.assertRaisesMessage(CommandError, msg):
popen_wrapper(['a_42_command_that_doesnt_exist_42'])