diff options
author | Mads Jensen <mje@inducks.org> | 2017-05-28 21:37:21 +0200 |
---|---|---|
committer | Tim Graham <timograham@gmail.com> | 2017-07-29 19:07:23 -0400 |
commit | a51c4de1945be2225f20fad794cfb52d8f1f9236 (patch) | |
tree | 36386b70a27cf027a8a491de319c3e59e0d3d0cd /tests/user_commands | |
parent | 38988f289f7f5708f5ea85de2d5dfe0d86b23106 (diff) | |
download | django-a51c4de1945be2225f20fad794cfb52d8f1f9236.tar.gz |
Used assertRaisesMessage() to test Django's error messages.
Diffstat (limited to 'tests/user_commands')
-rw-r--r-- | tests/user_commands/tests.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/user_commands/tests.py b/tests/user_commands/tests.py index 19ae51b096..3900a58247 100644 --- a/tests/user_commands/tests.py +++ b/tests/user_commands/tests.py @@ -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']) |