mirror of
https://github.com/SectorLabs/django-localized-fields.git
synced 2025-04-24 19:32:53 +03:00
Add simple test for LOCALIZED_FIELDS_FALLBACKS setting
This commit is contained in:
parent
16e23963cc
commit
7316d312b4
@ -143,6 +143,26 @@ class LocalizedValueTestCase(TestCase):
|
||||
# there's no actual value
|
||||
assert localized_value.get(other_language) != test_value
|
||||
|
||||
@staticmethod
|
||||
def test_str_fallback_custom_fallback():
|
||||
"""Tests whether the :see:LocalizedValue class's
|
||||
__str__'s fallback functionality properly respects
|
||||
the LOCALIZED_FIELDS_FALLBACKS setting."""
|
||||
|
||||
test_value = 'myvalue'
|
||||
|
||||
settings.LOCALIZED_FIELDS_FALLBACKS = {
|
||||
'nl': ['ro']
|
||||
}
|
||||
|
||||
localized_value = LocalizedValue({
|
||||
settings.LANGUAGE_CODE: settings.LANGUAGE_CODE,
|
||||
'ro': 'ro'
|
||||
})
|
||||
|
||||
with translation.override('nl'):
|
||||
assert str(localized_value) == 'ro'
|
||||
|
||||
@staticmethod
|
||||
def test_deconstruct():
|
||||
"""Tests whether the :see:LocalizedValue
|
||||
|
Loading…
x
Reference in New Issue
Block a user