tests: update API tests to work with latest django-webtest (#36331)
This commit is contained in:
parent
fe7f3482c8
commit
3432648af7
|
@ -1,2 +1,6 @@
|
|||
TIME_ZONE = 'Europe/Paris'
|
||||
LANGUAGE_CODE = 'en-us'
|
||||
|
||||
REST_FRAMEWORK = {
|
||||
'DEFAULT_AUTHENTICATION_CLASSES': ['rest_framework.authentication.BasicAuthentication'],
|
||||
}
|
||||
|
|
|
@ -333,7 +333,7 @@ def test_booking_api(app, some_data, user):
|
|||
event = [x for x in Event.objects.filter(agenda=agenda) if x.in_bookable_period()][0]
|
||||
|
||||
# unauthenticated
|
||||
resp = app.post('/api/agenda/%s/fillslot/%s/' % (agenda.slug, event.id), status=403)
|
||||
resp = app.post('/api/agenda/%s/fillslot/%s/' % (agenda.slug, event.id), status=401)
|
||||
|
||||
for agenda_key in (agenda.slug, agenda.id): # acces datetimes via agenda slug or id (legacy)
|
||||
resp_datetimes = app.get('/api/agenda/%s/datetimes/' % agenda_key)
|
||||
|
@ -446,7 +446,7 @@ def test_booking_ics(app, some_data, meetings_agenda, user):
|
|||
|
||||
# unauthenticated
|
||||
app.authorization = None
|
||||
app.get('/api/booking/%s/ics/' % resp.json['booking_id'], status=403)
|
||||
app.get('/api/booking/%s/ics/' % resp.json['booking_id'], status=401)
|
||||
|
||||
app.authorization = ('Basic', ('john.doe', 'password'))
|
||||
resp = app.get('/api/booking/%s/ics/' % resp.json['booking_id'])
|
||||
|
@ -485,7 +485,7 @@ def test_booking_api_fillslots(app, some_data, user):
|
|||
event = [x for x in Event.objects.filter(agenda=agenda) if x.in_bookable_period()][0] # first event
|
||||
|
||||
# unauthenticated
|
||||
resp = app.post('/api/agenda/%s/fillslots/' % agenda.slug, status=403)
|
||||
resp = app.post('/api/agenda/%s/fillslots/' % agenda.slug, status=401)
|
||||
|
||||
for agenda_key in (agenda.slug, agenda.id): # acces datetimes via agenda slug or id (legacy)
|
||||
resp_datetimes = app.get('/api/agenda/%s/datetimes/' % agenda_key)
|
||||
|
@ -895,7 +895,7 @@ def test_booking_api_with_cancel_booking(app, some_data, user):
|
|||
def test_booking_cancellation_api(app, some_data, user):
|
||||
agenda_id = Agenda.objects.filter(label=u'Foo bar')[0].id
|
||||
event = Event.objects.filter(agenda_id=agenda_id)[0]
|
||||
resp = app.post('/api/agenda/%s/fillslot/%s/' % (agenda_id, event.id), status=403)
|
||||
resp = app.post('/api/agenda/%s/fillslot/%s/' % (agenda_id, event.id), status=401)
|
||||
|
||||
app.authorization = ('Basic', ('john.doe', 'password'))
|
||||
resp = app.post('/api/agenda/%s/fillslot/%s/' % (agenda_id, event.id))
|
||||
|
@ -907,7 +907,7 @@ def test_booking_cancellation_api(app, some_data, user):
|
|||
def test_booking_cancellation_post_api(app, some_data, user):
|
||||
agenda_id = Agenda.objects.filter(label=u'Foo bar')[0].id
|
||||
event = Event.objects.filter(agenda_id=agenda_id)[0]
|
||||
resp = app.post('/api/agenda/%s/fillslot/%s/' % (agenda_id, event.id), status=403)
|
||||
resp = app.post('/api/agenda/%s/fillslot/%s/' % (agenda_id, event.id), status=401)
|
||||
|
||||
app.authorization = ('Basic', ('john.doe', 'password'))
|
||||
resp = app.post('/api/agenda/%s/fillslot/%s/' % (agenda_id, event.id))
|
||||
|
@ -976,7 +976,7 @@ def test_status(app, some_data, user):
|
|||
event = Event.objects.filter(agenda_id=agenda_id)[0]
|
||||
Booking(event=event).save()
|
||||
|
||||
resp = app.get('/api/agenda/%s/status/%s/' % (agenda_id, event.id), status=403)
|
||||
resp = app.get('/api/agenda/%s/status/%s/' % (agenda_id, event.id), status=401)
|
||||
|
||||
app.authorization = ('Basic', ('john.doe', 'password'))
|
||||
resp = app.get('/api/agenda/%s/status/%s/' % (agenda_id, 9999), status=404)
|
||||
|
|
Loading…
Reference in New Issue