implement basic testing fixtures and linting
This commit is contained in:
34
backend/src/tests/test_main.py
Normal file
34
backend/src/tests/test_main.py
Normal 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
|
Reference in New Issue
Block a user