Files
anyway/backend/src/tests/test_main.py
Remy Moll acc7631c55
Some checks failed
Build and push docker image / Build (pull_request) Successful in 1m40s
Run linting on the backend code / Build (pull_request) Failing after 10s
Build and release APK / Build APK (pull_request) Has been cancelled
implement basic testing fixtures and linting
2024-08-12 12:44:51 +02:00

35 lines
873 B
Python

from fastapi.testclient import TestClient
import pytest
from ..main import app
@pytest.fixture()
def client():
return TestClient(app)
def test_new_trip_invalid_prefs(client):
response = client.post(
"/trip/new",
json={
"preferences": {},
"start": [48.8566, 2.3522]
}
)
assert response.status_code == 422
def test_new_trip_single_prefs(client):
response = client.post(
"/trip/new",
json={
"preferences": {"sightseeing": {"type": "sightseeing", "score": 1}, "nature": {"type": "nature", "score": 1}, "shopping": {"type": "shopping", "score": 1}, "max_time_minute": 360, "detour_tolerance_minute": 0},
"start": [48.8566, 2.3522]
}
)
assert response.status_code == 200
def test_new_trip_matches_prefs(client):
# todo
pass