mirror of
https://github.com/django/django.git
synced 2025-12-04 00:55:36 +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
|
|
@ -60,7 +60,11 @@ class OnDeleteTests(TestCase):
|
|||
|
||||
def test_protect(self):
|
||||
a = create_a('protect')
|
||||
with self.assertRaises(IntegrityError):
|
||||
msg = (
|
||||
"Cannot delete some instances of model 'R' because they are "
|
||||
"referenced through a protected foreign key: 'A.protect'"
|
||||
)
|
||||
with self.assertRaisesMessage(IntegrityError, msg):
|
||||
a.protect.delete()
|
||||
|
||||
def test_do_nothing(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue