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

@ -123,7 +123,8 @@ class AdvancedTests(TestCase):
We do not support update on already sliced query sets.
"""
method = DataPoint.objects.all()[:2].update
with self.assertRaises(AssertionError):
msg = 'Cannot update a query once a slice has been taken.'
with self.assertRaisesMessage(AssertionError, msg):
method(another_value='another thing')
def test_update_respects_to_field(self):