Project

General

Profile

0001-api-make-sure-event-status-API-only-accepts-numbers-.patch

Frédéric Péters, 07 Feb 2019 01:36 PM

Download (1.5 KB)

View differences:

Subject: [PATCH] api: make sure event status API only accepts numbers (#30459)

 chrono/api/urls.py | 2 +-
 tests/test_api.py  | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
chrono/api/urls.py
27 27
        views.fillslot, name='api-fillslot'),
28 28
    url(r'agenda/(?P<agenda_identifier>[\w-]+)/fillslots/$',
29 29
        views.fillslots, name='api-agenda-fillslots'),
30
    url(r'agenda/(?P<agenda_identifier>[\w-]+)/status/(?P<event_pk>\w+)/$', views.slot_status,
30
    url(r'agenda/(?P<agenda_identifier>[\w-]+)/status/(?P<event_pk>\d+)/$', views.slot_status,
31 31
        name='api-event-status'),
32 32

  
33 33
    url(r'agenda/meetings/(?P<meeting_identifier>[\w-]+)/datetimes/$',
tests/test_api.py
797 797

  
798 798
    app.authorization = ('Basic', ('john.doe', 'password'))
799 799
    resp = app.get('/api/agenda/%s/status/%s/' % (agenda_id, 9999), status=404)
800
    resp = app.get('/api/agenda/%s/status/%s/' % (agenda_id, 'xx'), status=404)
800 801

  
801 802
    resp = app.get('/api/agenda/%s/status/%s/' % (agenda_id, event.id))
802 803
    assert resp.json['err'] == 0
803
-