implement basic testing fixtures and linting
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

This commit is contained in:
2024-08-12 12:44:51 +02:00
parent bea3a65fec
commit acc7631c55
18 changed files with 404 additions and 720 deletions

View File

@@ -0,0 +1,34 @@
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