Project

General

Profile

0001-misc-add-event-duration-in-export-and-api-56786.patch

Valentin Deniaud, 08 September 2021 12:38 PM

Download (2.65 KB)

View differences:

Subject: [PATCH] misc: add event duration in export and api (#56786)

 chrono/agendas/models.py    | 1 +
 chrono/api/views.py         | 1 +
 tests/api/test_event.py     | 1 +
 tests/test_import_export.py | 2 ++
 4 files changed, 5 insertions(+)
chrono/agendas/models.py
1542 1542
            'description': self.description,
1543 1543
            'url': self.url,
1544 1544
            'pricing': self.pricing,
1545
            'duration': self.duration,
1545 1546
        }
1546 1547

  
1547 1548
    def duplicate(self, agenda_target=None):
chrono/api/views.py
469 469
        'description': event.description,
470 470
        'pricing': event.pricing,
471 471
        'url': event.url,
472
        'duration': event.duration,
472 473
        'disabled': is_event_disabled(event, min_places=min_places, disable_booked=disable_booked),
473 474
        'api': {
474 475
            'bookings_url': request.build_absolute_uri(
tests/api/test_event.py
46 46
        'pricing': None,
47 47
        'url': None,
48 48
        'disabled': False,
49
        'duration': None,
49 50
        'api': {
50 51
            'bookings_url': 'http://testserver/api/agenda/foo-bar/bookings/event-slug/',
51 52
            'fillslot_url': 'http://testserver/api/agenda/foo-bar/fillslot/event-slug/',
tests/test_import_export.py
186 186
        publication_date=datetime.date(2020, 5, 11),
187 187
        places=42,
188 188
        start_datetime=now(),
189
        duration=30,
189 190
    )
190 191
    # check event (agenda, slug) unicity
191 192
    agenda2 = Agenda.objects.create(label='Foo Bar 2', kind='events')
......
214 215
    assert first_imported_event.pricing == '100'
215 216
    assert first_imported_event.url == 'https://example.net/'
216 217
    assert first_imported_event.publication_date == datetime.date(2020, 5, 11)
218
    assert first_imported_event.duration == 30
217 219
    assert Agenda.objects.get(label='Foo Bar 2').event_set.first().slug == 'event'
218 220

  
219 221

  
220
-