FIX: some localtime issues.

This commit is contained in:
2019-06-12 16:57:09 +02:00
parent f29e13ae4b
commit f961110a7c
5 changed files with 17 additions and 11 deletions

View File

@@ -4,6 +4,7 @@ from babel.dates import format_datetime
from django.apps import apps
from django.core import mail as django_mail
from django.test import TestCase
from django.utils import timezone
from django.utils.translation import get_language
from dav_base.tests.generic import EmailTestMixin
@@ -131,8 +132,10 @@ class EmailsTestCase(EmailTestMixin, EventMixin, RegistrationMixin, TestCase):
trainer_full_name=trainer.get_full_name(),
trainer_first_name=trainer.first_name,
registration_hexstr=registration.hexstr,
registration_at=format_datetime(registration.created_at, 'EEEE, dd. MMMM yyyy, H:mm', locale=locale),
purge_at=format_datetime(registration.purge_at, 'EEEE, dd. MMMM yyyy', locale=locale),
registration_at=format_datetime(timezone.localtime(registration.created_at),
'EEEE, dd. MMMM yyyy, H:mm', locale=locale),
purge_at=format_datetime(timezone.localtime(registration.purge_at),
'EEEE, dd. MMMM yyyy', locale=locale),
)
self.assertBody(mail, body)
@@ -226,8 +229,10 @@ class EmailsTestCase(EmailTestMixin, EventMixin, RegistrationMixin, TestCase):
event_formated_date=event.get_formated_date(),
trainer_first_name=trainer.first_name,
registration_hexstr=registration.hexstr,
registration_at=format_datetime(registration.created_at, 'EEEE, dd. MMMM yyyy, H:mm', locale=locale),
purge_at=format_datetime(registration.purge_at, 'EEEE, dd. MMMM yyyy', locale=locale),
registration_at=format_datetime(timezone.localtime(registration.created_at),
'EEEE, dd. MMMM yyyy, H:mm', locale=locale),
purge_at=format_datetime(timezone.localtime(registration.purge_at),
'EEEE, dd. MMMM yyyy', locale=locale),
)
self.assertBody(mail, body)