Some checks failed
Run testing on the backend code / Build (pull_request) Failing after 1m29s
Build and deploy the backend to staging / Build and push image (pull_request) Failing after 41s
Build and deploy the backend to staging / Deploy to staging (pull_request) Has been skipped
Run linting on the backend code / Build (pull_request) Successful in 27s
43 lines
1.3 KiB
Python
43 lines
1.3 KiB
Python
"""Collection of tests to ensure correct handling of invalid input."""
|
|
|
|
from fastapi.testclient import TestClient
|
|
import pytest
|
|
|
|
from .test_utils import load_trip_landmarks
|
|
from ..main import app
|
|
|
|
|
|
@pytest.fixture(scope="module")
|
|
def client():
|
|
"""Client used to call the app."""
|
|
return TestClient(app)
|
|
|
|
|
|
def test_cache(client, request): # pylint: disable=redefined-outer-name
|
|
"""
|
|
Test n°1 : Custom test in Turckheim to ensure small villages are also supported.
|
|
|
|
Args:
|
|
client:
|
|
request:
|
|
"""
|
|
duration_minutes = 15
|
|
response = client.post(
|
|
"/trip/new",
|
|
json={
|
|
"preferences": {"sightseeing": {"type": "sightseeing", "score": 5},
|
|
"nature": {"type": "nature", "score": 5},
|
|
"shopping": {"type": "shopping", "score": 5},
|
|
"max_time_minute": duration_minutes,
|
|
"detour_tolerance_minute": 0},
|
|
"start": [48.084588, 7.280405]
|
|
}
|
|
)
|
|
result = response.json()
|
|
landmarks = load_trip_landmarks(client, result['first_landmark_uuid'])
|
|
landmarks_cached = load_trip_landmarks(client, result['first_landmark_uuid'], True)
|
|
|
|
# checks :
|
|
assert response.status_code == 200 # check for successful planning
|
|
assert landmarks_cached == landmarks
|