1
0
mirror of https://github.com/django/django.git synced 2025-10-23 21:59:11 +00:00

[1.8.x] Fixed #24319 -- Added validation for UUID model field

Backport of de0241eb98 from master
This commit is contained in:
Josh Smeaton
2015-02-12 13:25:12 +11:00
parent 03f4e2d909
commit 1784c326b1
2 changed files with 11 additions and 2 deletions

View File

@@ -34,6 +34,15 @@ class TestSaveLoad(TestCase):
loaded = NullableUUIDModel.objects.get()
self.assertEqual(loaded.field, None)
def test_wrong_value(self):
self.assertRaisesMessage(
ValueError, 'badly formed hexadecimal UUID string',
UUIDModel.objects.get, field='not-a-uuid')
self.assertRaisesMessage(
ValueError, 'badly formed hexadecimal UUID string',
UUIDModel.objects.create, field='not-a-uuid')
class TestMigrations(TestCase):