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
1 changed files with 2 additions and 2 deletions

View File

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