1
0
mirror of https://github.com/django/django.git synced 2024-12-22 17:16:24 +00:00

Made OnDeleteTests.test_protect() assert more specific ProtectedError.

This commit is contained in:
Mariusz Felisiak 2020-01-27 11:30:56 +01:00
parent ab3cbd8b9a
commit c00b863ac6

View File

@ -1,6 +1,6 @@
from math import ceil from math import ceil
from django.db import IntegrityError, connection, models from django.db import connection, models
from django.db.models.deletion import ( from django.db.models.deletion import (
Collector, ProtectedError, RestrictedError, Collector, ProtectedError, RestrictedError,
) )
@ -76,7 +76,7 @@ class OnDeleteTests(TestCase):
"Cannot delete some instances of model 'R' because they are " "Cannot delete some instances of model 'R' because they are "
"referenced through protected foreign keys: 'A.protect'." "referenced through protected foreign keys: 'A.protect'."
) )
with self.assertRaisesMessage(IntegrityError, msg): with self.assertRaisesMessage(ProtectedError, msg):
a.protect.delete() a.protect.delete()
def test_protect_multiple(self): def test_protect_multiple(self):