mirror of
https://github.com/SectorLabs/django-localized-fields.git
synced 2025-04-25 11:42:54 +03:00
Added test for dict init on LocalizedModel
This commit is contained in:
parent
5f5568d380
commit
03e8a7383f
@ -27,3 +27,23 @@ class LocalizedModelTestCase(TestCase):
|
||||
obj = cls.TestModel()
|
||||
|
||||
assert isinstance(obj.title, LocalizedValue)
|
||||
|
||||
|
||||
@classmethod
|
||||
def test_model_init_kwargs(cls):
|
||||
"""Tests whether all :see:LocalizedField
|
||||
fields are assigned an empty :see:LocalizedValue
|
||||
instance when the model is instanitiated."""
|
||||
data = {
|
||||
'title': {
|
||||
'en': 'english_title',
|
||||
'ro': 'romanian_title',
|
||||
'nl': 'dutch_title'
|
||||
}
|
||||
}
|
||||
obj = cls.TestModel(**data)
|
||||
|
||||
assert isinstance(obj.title, LocalizedValue)
|
||||
assert obj.title.en == 'english_title'
|
||||
assert obj.title.ro == 'romanian_title'
|
||||
assert obj.title.nl == 'dutch_title'
|
Loading…
x
Reference in New Issue
Block a user