mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
Fixed #27148 -- Fixed ModelMultipleChoiceField crash with invalid UUID.
This commit is contained in:
@@ -40,17 +40,17 @@ class TestSaveLoad(TestCase):
|
||||
self.assertIsNone(loaded.field)
|
||||
|
||||
def test_pk_validated(self):
|
||||
with self.assertRaisesMessage(TypeError, 'is not a valid UUID'):
|
||||
with self.assertRaisesMessage(exceptions.ValidationError, 'is not a valid UUID'):
|
||||
PrimaryKeyUUIDModel.objects.get(pk={})
|
||||
|
||||
with self.assertRaisesMessage(TypeError, 'is not a valid UUID'):
|
||||
with self.assertRaisesMessage(exceptions.ValidationError, 'is not a valid UUID'):
|
||||
PrimaryKeyUUIDModel.objects.get(pk=[])
|
||||
|
||||
def test_wrong_value(self):
|
||||
with self.assertRaisesMessage(ValueError, 'badly formed hexadecimal UUID string'):
|
||||
with self.assertRaisesMessage(exceptions.ValidationError, 'is not a valid UUID'):
|
||||
UUIDModel.objects.get(field='not-a-uuid')
|
||||
|
||||
with self.assertRaisesMessage(ValueError, 'badly formed hexadecimal UUID string'):
|
||||
with self.assertRaisesMessage(exceptions.ValidationError, 'is not a valid UUID'):
|
||||
UUIDModel.objects.create(field='not-a-uuid')
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user