Projet

Général

Profil

0001-allow-booking-s-ics-summary-field-overriding-25820.patch

Serghei Mihai, 24 août 2018 15:38

Télécharger (2,4 ko)

Voir les différences:

Subject: [PATCH] allow booking's ics 'summary' field overriding (#25820)

 chrono/agendas/models.py | 2 +-
 tests/test_api.py        | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)
chrono/agendas/models.py
382 382
        vevent = vobject.newFromBehavior('vevent')
383 383
        vevent.add('uid').value = '%s-%s-%s' % (self.event.start_datetime.isoformat(), self.event.agenda.pk, self.pk)
384 384

  
385
        vevent.add('summary').value = self.label
385
        vevent.add('summary').value = request and request.GET.get('summary') or self.label
386 386
        vevent.add('dtstart').value = self.event.start_datetime
387 387
        if self.user_name:
388 388
            vevent.add('attendee').value = self.user_name
tests/test_api.py
412 412
    assert 'COMMENT:booking comment\r\n' in booking_ics
413 413
    assert 'LOCATION:bar\r\n' in booking_ics
414 414
    assert 'DESCRIPTION:booking description\r\n' in booking_ics
415
    assert 'SUMMARY:l\r\n' in booking_ics
415 416

  
416 417
    # unauthenticated
417 418
    app.authorization = None
......
422 423
    assert resp.headers['Content-Type'] == 'text/calendar'
423 424

  
424 425
    params = {'description': 'custom booking description', 'location': 'custom booking location',
425
              'comment': 'custom comment', 'url': 'http://example.com/custom'}
426
              'comment': 'custom comment', 'url': 'http://example.com/custom', 'summary': 'my booking'}
426 427
    resp = app.get('/api/booking/%s/ics/' % booking_id, params=params)
427 428
    assert 'DESCRIPTION:custom booking description\r\n' in resp.text
428 429
    assert 'LOCATION:custom booking location\r\n' in resp.text
429 430
    assert 'COMMENT:custom comment\r\n' in resp.text
430 431
    assert 'URL:http://example.com/custom\r\n' in resp.text
432
    assert 'SUMMARY:my booking\r\n' in resp.text
431 433

  
432 434
    meetings_agenda_id = Agenda.objects.filter(label=u'Foo bar Meeting')[0].id
433 435
    meeting_type = MeetingType.objects.get(agenda=meetings_agenda)
434
-