api: change http status code on wrong agenda kind error (#16813)

This commit is contained in:
Frédéric Péters 2017-06-10 21:22:29 +02:00
parent 998b6575f8
commit 7abcd52464
2 changed files with 2 additions and 3 deletions

View File

@ -22,7 +22,6 @@ from django.shortcuts import get_object_or_404
from django.utils.timezone import now, make_aware, localtime
from rest_framework import permissions, serializers
from rest_framework.exceptions import APIException
from rest_framework.generics import GenericAPIView
from rest_framework.response import Response
from rest_framework.views import APIView
@ -62,7 +61,7 @@ class Datetimes(GenericAPIView):
except ValueError:
raise Http404()
if agenda.kind != 'events':
raise APIException('not an events agenda')
raise Http404('agenda found, but it was not an events agenda')
kwargs = {}
if agenda.minimal_booking_delay:

View File

@ -155,7 +155,7 @@ def test_datetimes_api_wrong_kind(app, some_data):
agenda = Agenda.objects.filter(label=u'Foo bar')[0]
agenda.kind = 'meetings'
agenda.save()
resp = app.get('/api/agenda/%s/datetimes/' % agenda.id, status=500)
resp = app.get('/api/agenda/%s/datetimes/' % agenda.id, status=404)
def test_datetime_api_fr(app, some_data):
agenda_id = Agenda.objects.filter(label=u'Foo bar')[0].id