api: add shortcut for event status url (#22125)
This commit is contained in:
parent
e34b22bdee
commit
a20bfdb254
|
@ -25,7 +25,8 @@ urlpatterns = [
|
|||
url(r'agenda/(?P<agenda_identifier>[\w-]+)/datetimes/$', views.datetimes, name='api-agenda-datetimes'),
|
||||
url(r'agenda/(?P<agenda_identifier>[\w-]+)/fillslot/(?P<event_pk>[\w:-]+)/$',
|
||||
views.fillslot, name='api-fillslot'),
|
||||
url(r'agenda/(?P<agenda_identifier>[\w-]+)/status/(?P<event_pk>\w+)/$', views.slot_status),
|
||||
url(r'agenda/(?P<agenda_identifier>[\w-]+)/status/(?P<event_pk>\w+)/$', views.slot_status,
|
||||
name='api-event-status'),
|
||||
|
||||
url(r'agenda/meetings/(?P<meeting_identifier>[\w-]+)/datetimes/$',
|
||||
views.meeting_datetimes, name='api-agenda-meeting-datetimes-legacy'),
|
||||
|
|
|
@ -187,6 +187,12 @@ class Datetimes(GenericAPIView):
|
|||
'agenda_identifier': agenda.slug,
|
||||
'event_pk': x.id,
|
||||
})),
|
||||
'status_url': request.build_absolute_uri(
|
||||
reverse('api-event-status',
|
||||
kwargs={
|
||||
'agenda_identifier': agenda.slug,
|
||||
'event_pk': x.id,
|
||||
}))
|
||||
},
|
||||
} for x in entries]}
|
||||
return Response(response)
|
||||
|
|
|
@ -206,6 +206,12 @@ def test_datetime_api_label(app, some_data):
|
|||
resp = app.get('/api/agenda/%s/datetimes/' % agenda_id)
|
||||
assert 'Hello world' in [x['text'] for x in resp.json['data']]
|
||||
|
||||
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['id'])
|
||||
|
||||
def test_datetimes_api_meetings_agenda(app, meetings_agenda):
|
||||
meeting_type = MeetingType.objects.get(agenda=meetings_agenda)
|
||||
api_url = '/api/agenda/%s/meetings/%s/datetimes/' % (
|
||||
|
|
Loading…
Reference in New Issue