api: make sure event status API only accepts numbers (#30459)

This commit is contained in:
Frédéric Péters 2019-02-07 13:35:52 +01:00
parent ed85d7122b
commit b9a2848a26
2 changed files with 2 additions and 1 deletions

View File

@ -27,7 +27,7 @@ urlpatterns = [
views.fillslot, name='api-fillslot'),
url(r'agenda/(?P<agenda_identifier>[\w-]+)/fillslots/$',
views.fillslots, name='api-agenda-fillslots'),
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>\d+)/$', views.slot_status,
name='api-event-status'),
url(r'agenda/meetings/(?P<meeting_identifier>[\w-]+)/datetimes/$',

View File

@ -797,6 +797,7 @@ def test_status(app, some_data, user):
app.authorization = ('Basic', ('john.doe', 'password'))
resp = app.get('/api/agenda/%s/status/%s/' % (agenda_id, 9999), status=404)
resp = app.get('/api/agenda/%s/status/%s/' % (agenda_id, 'xx'), status=404)
resp = app.get('/api/agenda/%s/status/%s/' % (agenda_id, event.id))
assert resp.json['err'] == 0