Make sure values are strings before saving LocalizedIntegerValue

This commit is contained in:
Swen Kooij
2018-06-15 16:19:32 +03:00
parent bca94a3508
commit fb233e8f25
3 changed files with 21 additions and 4 deletions

View File

@@ -152,3 +152,14 @@ class LocalizedIntegerFieldTestCase(TestCase):
obj.refresh_from_db()
assert obj.score.get(settings.LANGUAGE_CODE) is None
def test_default_value(self):
"""Tests whether a default is properly set
when specified."""
model = get_fake_model({
'score': LocalizedIntegerField(default={settings.LANGUAGE_CODE: 75})
})
obj = model.objects.create()
assert obj.score.get(settings.LANGUAGE_CODE) == 75