api: only use event slug in URLs when it is set (#38081)
This commit is contained in:
parent
15b2b27986
commit
5be7a36833
|
@ -211,13 +211,13 @@ class Datetimes(APIView):
|
|||
reverse('api-fillslot',
|
||||
kwargs={
|
||||
'agenda_identifier': agenda.slug,
|
||||
'event_identifier': x.slug,
|
||||
'event_identifier': x.slug or x.id,
|
||||
})),
|
||||
'status_url': request.build_absolute_uri(
|
||||
reverse('api-event-status',
|
||||
kwargs={
|
||||
'agenda_identifier': agenda.slug,
|
||||
'event_identifier': x.slug,
|
||||
'event_identifier': x.slug or x.id,
|
||||
}))
|
||||
},
|
||||
} for x in entries]}
|
||||
|
|
|
@ -225,7 +225,8 @@ def test_datetime_api_status_url(app, some_data):
|
|||
agenda = Agenda.objects.get(label=u'Foo bar2')
|
||||
resp = app.get('/api/agenda/%s/datetimes/' % agenda.slug)
|
||||
for datum in resp.json['data']:
|
||||
assert urlparse.urlparse(datum['api']['status_url']).path == '/api/agenda/%s/status/%s/' % (agenda.slug, datum['slug'])
|
||||
assert urlparse.urlparse(datum['api']['status_url']).path == '/api/agenda/%s/status/%s/' % (
|
||||
agenda.slug, datum['slug'] or datum['id'])
|
||||
|
||||
def test_datetimes_api_meetings_agenda(app, meetings_agenda):
|
||||
meeting_type = MeetingType.objects.get(agenda=meetings_agenda)
|
||||
|
@ -337,7 +338,7 @@ def test_booking_api(app, some_data, user):
|
|||
for agenda_key in (agenda.slug, agenda.id): # acces datetimes via agenda slug or id (legacy)
|
||||
resp_datetimes = app.get('/api/agenda/%s/datetimes/' % agenda_key)
|
||||
event_fillslot_url = [x for x in resp_datetimes.json['data'] if x['id'] == event.id][0]['api']['fillslot_url']
|
||||
assert urlparse.urlparse(event_fillslot_url).path == '/api/agenda/%s/fillslot/%s/' % (agenda.slug, event.slug)
|
||||
assert urlparse.urlparse(event_fillslot_url).path == '/api/agenda/%s/fillslot/%s/' % (agenda.slug, event.slug or event.id)
|
||||
|
||||
app.authorization = ('Basic', ('john.doe', 'password'))
|
||||
resp = app.post('/api/agenda/%s/fillslot/%s/' % (agenda.slug, event.id))
|
||||
|
|
Loading…
Reference in New Issue