api: change http status code on wrong agenda kind error (#16813)
This commit is contained in:
parent
998b6575f8
commit
7abcd52464
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue