mirror of
https://github.com/SectorLabs/django-localized-fields.git
synced 2025-12-14 15:52:25 +03:00
Created abstract model to take care of default values
This commit is contained in:
29
tests/test_localized_model.py
Normal file
29
tests/test_localized_model.py
Normal file
@@ -0,0 +1,29 @@
|
||||
from django.test import TestCase
|
||||
|
||||
from localized_fields.fields import LocalizedValue
|
||||
|
||||
from .fake_model import get_fake_model
|
||||
|
||||
|
||||
class LocalizedModelTestCase(TestCase):
|
||||
"""Tests whether the :see:LocalizedModel class."""
|
||||
|
||||
TestModel = None
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
"""Creates the test model in the database."""
|
||||
|
||||
super(LocalizedModelTestCase, cls).setUpClass()
|
||||
|
||||
cls.TestModel = get_fake_model()
|
||||
|
||||
@classmethod
|
||||
def test_defaults(cls):
|
||||
"""Tests whether all :see:LocalizedField
|
||||
fields are assigned an empty :see:LocalizedValue
|
||||
instance when the model is instanitiated."""
|
||||
|
||||
obj = cls.TestModel()
|
||||
|
||||
assert isinstance(obj.title, LocalizedValue)
|
||||
Reference in New Issue
Block a user