0004-api-rename-recurring-events-views-55367.patch
chrono/api/urls.py | ||
---|---|---|
22 | 22 |
url(r'^agenda/$', views.agendas), |
23 | 23 |
url(r'^agenda/(?P<agenda_identifier>[\w-]+)/$', views.agenda_detail), |
24 | 24 |
url(r'^agenda/(?P<agenda_identifier>[\w-]+)/datetimes/$', views.datetimes, name='api-agenda-datetimes'), |
25 |
url( |
|
26 |
r'^agenda/(?P<agenda_identifier>[\w-]+)/recurring_events/$', |
|
27 |
views.recurring_events_list, |
|
28 |
name='api-agenda-recurring-events', |
|
29 |
), |
|
30 | 25 |
url( |
31 | 26 |
r'^agenda/(?P<agenda_identifier>[\w-]+)/fillslot/(?P<event_identifier>[\w:-]+)/$', |
32 | 27 |
views.fillslot, |
... | ... | |
39 | 34 |
name='api-agenda-events-fillslots', |
40 | 35 |
), |
41 | 36 |
url( |
42 |
r'^agenda/(?P<agenda_identifier>[\w-]+)/recurring_fillslots/$', |
|
37 |
r'^agenda/(?P<agenda_identifier>[\w-]+)/recurring-events/$', |
|
38 |
views.recurring_events_list, |
|
39 |
name='api-agenda-recurring-events', |
|
40 |
), |
|
41 |
url( |
|
42 |
r'^agenda/(?P<agenda_identifier>[\w-]+)/recurring-events/fillslots/$', |
|
43 | 43 |
views.recurring_fillslots, |
44 | 44 |
name='api-recurring-fillslots', |
45 | 45 |
), |
tests/api/test_datetimes.py | ||
---|---|---|
1296 | 1296 |
agenda=agenda, |
1297 | 1297 |
) |
1298 | 1298 | |
1299 |
resp = app.get('/api/agenda/xxx/recurring_events/', status=404)
|
|
1299 |
resp = app.get('/api/agenda/xxx/recurring-events/', status=404)
|
|
1300 | 1300 | |
1301 | 1301 |
# recurring events without recurrence_end_date are not bookable |
1302 |
resp = app.get('/api/agenda/%s/recurring_events/' % agenda.slug)
|
|
1302 |
resp = app.get('/api/agenda/%s/recurring-events/' % agenda.slug)
|
|
1303 | 1303 |
assert len(resp.json['data']) == 0 |
1304 | 1304 | |
1305 | 1305 |
event.recurrence_end_date = now() + datetime.timedelta(days=30) |
... | ... | |
1314 | 1314 |
recurrence_end_date=now() + datetime.timedelta(days=45), |
1315 | 1315 |
) |
1316 | 1316 | |
1317 |
resp = app.get('/api/agenda/%s/recurring_events/' % agenda.slug)
|
|
1317 |
resp = app.get('/api/agenda/%s/recurring-events/' % agenda.slug)
|
|
1318 | 1318 |
assert len(resp.json['data']) == 4 |
1319 | 1319 |
assert resp.json['data'][0]['id'] == 'example-event:0' |
1320 | 1320 |
assert resp.json['data'][0]['text'] == 'Monday: Example Event' |
... | ... | |
1327 | 1327 | |
1328 | 1328 |
event.publication_date = now() + datetime.timedelta(days=2) |
1329 | 1329 |
event.save() |
1330 |
resp = app.get('/api/agenda/%s/recurring_events/' % agenda.slug)
|
|
1330 |
resp = app.get('/api/agenda/%s/recurring-events/' % agenda.slug)
|
|
1331 | 1331 |
assert len(resp.json['data']) == 1 |
1332 | 1332 | |
1333 | 1333 |
freezer.move_to(event.recurrence_end_date) |
1334 |
resp = app.get('/api/agenda/%s/recurring_events/' % agenda.slug)
|
|
1334 |
resp = app.get('/api/agenda/%s/recurring-events/' % agenda.slug)
|
|
1335 | 1335 |
assert len(resp.json['data']) == 1 |
tests/api/test_fillslot.py | ||
---|---|---|
2128 | 2128 |
) |
2129 | 2129 |
sunday_event.create_all_recurrences() |
2130 | 2130 | |
2131 |
resp = app.get('/api/agenda/%s/recurring_events/' % agenda.slug)
|
|
2131 |
resp = app.get('/api/agenda/%s/recurring-events/' % agenda.slug)
|
|
2132 | 2132 |
assert len(resp.json['data']) == 5 |
2133 | 2133 | |
2134 | 2134 |
app.authorization = ('Basic', ('john.doe', 'password')) |
2135 |
fillslots_url = '/api/agenda/%s/recurring_fillslots/' % agenda.slug
|
|
2135 |
fillslots_url = '/api/agenda/%s/recurring-events/fillslots/' % agenda.slug
|
|
2136 | 2136 |
params = {'user_external_id': 'user_id'} |
2137 | 2137 |
# Book Monday and Thursday of first event and Sunday of second event |
2138 | 2138 |
params['slots'] = 'event:0,event:3,sunday-event:6' |
... | ... | |
2221 | 2221 | |
2222 | 2222 |
# check that new bookings are put in waiting list despite free slots on main list |
2223 | 2223 |
params = {'user_external_id': 'user_id', 'slots': 'event:0'} |
2224 |
resp = app.post_json('/api/agenda/%s/recurring_fillslots/' % agenda.slug, params=params)
|
|
2224 |
resp = app.post_json('/api/agenda/%s/recurring-events/fillslots/' % agenda.slug, params=params)
|
|
2225 | 2225 |
assert resp.json['booking_count'] == 5 |
2226 | 2226 |
assert events.filter(waiting_list_count=2).count() == 5 |
2227 | 2227 | |
2228 |
- |