Added test for serialization of LazyI18nString in settings

This commit is contained in:
Raphael Michel
2016-03-20 14:35:22 +01:00
parent e3ac04fe86
commit be4435cdd8
2 changed files with 7 additions and 0 deletions

View File

@@ -78,6 +78,9 @@ class LazyI18nString:
def __format__(self, format_spec):
return self.__str__()
def __eq__(self, other):
return self.data == other.data
class LazyGettextProxy:
def __init__(self, lazygettext):
self.lazygettext = lazygettext

View File

@@ -7,6 +7,7 @@ from django.test import TestCase
from django.utils.timezone import now
from pretix.base import settings
from pretix.base.i18n import LazyI18nString
from pretix.base.models import Event, Organizer, OrganizerSetting, User
from pretix.base.settings import SettingsSandbox
@@ -127,6 +128,9 @@ class SettingsTestCase(TestCase):
def test_serialize_list(self):
self._test_serialization([1, 2, 'a'], list)
def test_serialize_lazyi18nstring(self):
self._test_serialization(LazyI18nString({'de': 'Hallo', 'en': 'Hello'}), LazyI18nString)
def test_serialize_bool(self):
self._test_serialization(True, bool)
self._test_serialization(False, bool)