mirror of
https://github.com/django/django.git
synced 2025-11-25 05:04:26 +00:00
Used assertRaisesMessage() to test Django's error messages.
This commit is contained in:
parent
38988f289f
commit
a51c4de194
69 changed files with 448 additions and 173 deletions
|
|
@ -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'])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue