diff options
| author | Josh Smeaton <josh.smeaton@gmail.com> | 2015-02-12 13:25:12 +1100 |
|---|---|---|
| committer | Josh Smeaton <josh.smeaton@gmail.com> | 2015-02-13 10:01:06 +1100 |
| commit | 1784c326b1040bc1957a6f9664fdd2a8647bde50 (patch) | |
| tree | 204a94a33df101c4a7808692bb373c7848164435 /tests/model_fields | |
| parent | 03f4e2d90997aec4c8f57c5c9b7925d70194327e (diff) | |
[1.8.x] Fixed #24319 -- Added validation for UUID model field
Backport of de0241eb985c6dec978beda119fee353ef3e9604 from master
Diffstat (limited to 'tests/model_fields')
| -rw-r--r-- | tests/model_fields/test_uuid.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/model_fields/test_uuid.py b/tests/model_fields/test_uuid.py index 4680d5dbb4..f06f4d02a7 100644 --- a/tests/model_fields/test_uuid.py +++ b/tests/model_fields/test_uuid.py @@ -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): |
