mirror of
https://github.com/Hopiu/django-model-utils.git
synced 2026-03-16 20:00:23 +00:00
UUIDModel tests
This commit is contained in:
parent
58e57d5535
commit
c23c622d17
1 changed files with 20 additions and 0 deletions
20
tests/test_models/test_uuid_model.py
Normal file
20
tests/test_models/test_uuid_model.py
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
from django.test import TestCase
|
||||
|
||||
from tests.models import CustomUUIDModel, CustomNotPrimaryUUIDModel
|
||||
|
||||
|
||||
class UUIDFieldTests(TestCase):
|
||||
|
||||
def test_uuid_model_with_uuid_field_as_primary_key(self):
|
||||
instance = CustomUUIDModel()
|
||||
instance.save()
|
||||
self.assertEqual(instance.id.__class__.__name__, 'UUID')
|
||||
self.assertEqual(instance.id, instance.pk)
|
||||
|
||||
def test_uuid_model_with_uuid_field_as_not_primary_key(self):
|
||||
instance = CustomNotPrimaryUUIDModel()
|
||||
instance.save()
|
||||
self.assertEqual(instance.uuid.__class__.__name__, 'UUID')
|
||||
self.assertNotEqual(instance.uuid, instance.pk)
|
||||
Loading…
Reference in a new issue