mirror of
https://github.com/pretix/pretix.git
synced 2026-05-04 15:04:03 +00:00
Fix #296 -- DST issues with expiry dates
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user