ants-hub/tests/api/test_ants.py

15 lines
547 B
Python

# ANTS-Hub - Copyright (C) Entr'ouvert
import pytest
@pytest.mark.parametrize(
'endpoint', ['getManagedMeetingPoints', 'availableTimeSlots', 'searchApplicationIds']
)
def test_authentication(endpoint, django_app, db, settings):
django_app.get(f'/api/ants/{endpoint}', status=401)
django_app.get(f'/api/ants/{endpoint}', headers={'X-Hub-Rdv-Auth-Token': 'abcd'}, status=401)
settings.ANTS_HUB_X_HUB_RDV_AUTH_TOKEN = 'abcd'
django_app.get(f'/api/ants/{endpoint}', headers={'X-Hub-Rdv-Auth-Token': 'abcd'}, status=(200, 422))