forked from CGM_Public/pretix_original
Fix iCal test failing due to new UID format
This commit is contained in:
@@ -19,6 +19,12 @@ def get_ical(events):
|
|||||||
for ev in events:
|
for ev in events:
|
||||||
event = ev if isinstance(ev, Event) else ev.event
|
event = ev if isinstance(ev, Event) else ev.event
|
||||||
tz = pytz.timezone(event.settings.timezone)
|
tz = pytz.timezone(event.settings.timezone)
|
||||||
|
if isinstance(ev, Event):
|
||||||
|
url = build_absolute_uri(event, 'presale:event.index')
|
||||||
|
else:
|
||||||
|
url = build_absolute_uri(event, 'presale:event.index', {
|
||||||
|
'subevent': ev.pk
|
||||||
|
})
|
||||||
|
|
||||||
vevent = cal.add('vevent')
|
vevent = cal.add('vevent')
|
||||||
vevent.add('summary').value = str(ev.name)
|
vevent.add('summary').value = str(ev.name)
|
||||||
@@ -29,7 +35,7 @@ def get_ical(events):
|
|||||||
vevent.add('uid').value = 'pretix-{}-{}-{}@{}'.format(
|
vevent.add('uid').value = 'pretix-{}-{}-{}@{}'.format(
|
||||||
event.organizer.slug, event.slug,
|
event.organizer.slug, event.slug,
|
||||||
ev.pk if not isinstance(ev, Event) else '0',
|
ev.pk if not isinstance(ev, Event) else '0',
|
||||||
urlparse(settings.SITE_URL).netloc
|
urlparse(url).netloc
|
||||||
)
|
)
|
||||||
|
|
||||||
if event.settings.show_times:
|
if event.settings.show_times:
|
||||||
@@ -44,13 +50,7 @@ def get_ical(events):
|
|||||||
vevent.add('dtend').value = ev.date_to.astimezone(tz).date()
|
vevent.add('dtend').value = ev.date_to.astimezone(tz).date()
|
||||||
|
|
||||||
descr = []
|
descr = []
|
||||||
|
descr.append(_('Tickets: {url}').format(url=url))
|
||||||
if isinstance(ev, Event):
|
|
||||||
descr.append(_('Tickets: {url}').format(url=build_absolute_uri(event, 'presale:event.index')))
|
|
||||||
else:
|
|
||||||
descr.append(_('Tickets: {url}').format(url=build_absolute_uri(event, 'presale:event.index', {
|
|
||||||
'subevent': ev.pk
|
|
||||||
})))
|
|
||||||
|
|
||||||
if ev.date_admission:
|
if ev.date_admission:
|
||||||
descr.append(str(_('Admission: {datetime}')).format(
|
descr.append(str(_('Admission: {datetime}')).format(
|
||||||
|
|||||||
@@ -852,7 +852,7 @@ class EventIcalDownloadTest(EventTestMixin, SoupTest):
|
|||||||
self.assertIn('LOCATION:DUMMY ARENA', ical, 'incorrect location')
|
self.assertIn('LOCATION:DUMMY ARENA', ical, 'incorrect location')
|
||||||
self.assertIn('ORGANIZER:%s' % self.event.organizer.name, ical, 'incorrect organizer')
|
self.assertIn('ORGANIZER:%s' % self.event.organizer.name, ical, 'incorrect organizer')
|
||||||
self.assertTrue(re.search(r'DTSTAMP:\d{8}T\d{6}Z', ical), 'incorrect timestamp')
|
self.assertTrue(re.search(r'DTSTAMP:\d{8}T\d{6}Z', ical), 'incorrect timestamp')
|
||||||
self.assertTrue(re.search(r'UID:\w*-\w*-0-\d{20}', ical), 'missing UID key')
|
self.assertTrue(re.search(r'UID:pretix-\w*-\w*-0@', ical), 'missing UID key')
|
||||||
|
|
||||||
def test_utc_timezone(self):
|
def test_utc_timezone(self):
|
||||||
ical = self.client.get('/%s/%s/ical/' % (self.orga.slug, self.event.slug)).content.decode()
|
ical = self.client.get('/%s/%s/ical/' % (self.orga.slug, self.event.slug)).content.decode()
|
||||||
|
|||||||
Reference in New Issue
Block a user