api: return a 404 on /status/ for non-existing booking id
This commit is contained in:
parent
b7d097dd7b
commit
2da78fd12a
|
@ -156,7 +156,7 @@ class SlotStatus(GenericAPIView):
|
|||
permission_classes = (permissions.IsAuthenticated,)
|
||||
|
||||
def get(self, request, agenda_pk=None, event_pk=None, format=None):
|
||||
event = Event.objects.filter(id=event_pk)[0]
|
||||
event = get_object_or_404(Event, id=event_pk)
|
||||
response = {
|
||||
'err': 0,
|
||||
'places': {
|
||||
|
|
|
@ -160,6 +160,8 @@ def test_status(app, some_data, user):
|
|||
resp = app.get('/api/agenda/%s/status/%s/' % (agenda_id, event.id), status=403)
|
||||
|
||||
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, event.id))
|
||||
assert resp.json['err'] == 0
|
||||
assert resp.json['places']['total'] == 10
|
||||
|
|
Loading…
Reference in New Issue