mirror of
https://github.com/django/django.git
synced 2025-11-20 03:30:00 +00:00
Fixed #27148 -- Fixed ModelMultipleChoiceField crash with invalid UUID.
This commit is contained in:
parent
de91c172cf
commit
2f9861d823
3 changed files with 13 additions and 10 deletions
|
|
@ -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')
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue