mirror of
https://github.com/pretix/pretix.git
synced 2026-05-04 15:04:03 +00:00
Added test for serialization of LazyI18nString in settings
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user