Fix #296 -- DST issues with expiry dates

This commit is contained in:
Raphael Michel
2016-11-29 17:05:12 +01:00
parent 982a622e88
commit 248ab25567
2 changed files with 15 additions and 1 deletions

View File

@@ -2,6 +2,7 @@ from datetime import datetime, timedelta
from decimal import Decimal
import pytest
import pytz
from django.test import TestCase
from django.utils.timezone import make_aware, now
@@ -70,6 +71,19 @@ def test_expiry_last(event):
assert (order.expires - today).days == 5
@pytest.mark.django_db
def test_expiry_dst(event):
event.settings.set('timezone', 'Europe/Berlin')
tz = pytz.timezone('Europe/Berlin')
utc = pytz.timezone('UTC')
today = tz.localize(datetime(2016, 10, 29, 12, 0, 0)).astimezone(utc)
order = _create_order(event, email='dummy@example.org', positions=[],
now_dt=today, payment_provider=FreeOrderProvider(event),
locale='de')
localex = order.expires.astimezone(tz)
assert (localex.hour, localex.minute) == (23, 59)
@pytest.mark.django_db
def test_expiring(event):
o1 = Order.objects.create(