full passed tests
This commit is contained in:
parent
16918369d7
commit
361b2b1f42
12
.vscode/launch.json
vendored
12
.vscode/launch.json
vendored
@ -21,15 +21,21 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Backend - tester",
|
||||
"name": "Backend - test",
|
||||
"type": "debugpy",
|
||||
"request": "launch",
|
||||
"program": "src/tester.py",
|
||||
"module": "pytest",
|
||||
"args": [
|
||||
"src/tests",
|
||||
"--log-cli-level=DEBUG",
|
||||
"--html=report.html",
|
||||
"--self-contained-html"
|
||||
],
|
||||
"env": {
|
||||
"DEBUG": "true"
|
||||
},
|
||||
"cwd": "${workspaceFolder}/backend"
|
||||
},
|
||||
},
|
||||
// frontend - flutter app
|
||||
{
|
||||
"name": "Frontend - debug",
|
||||
|
File diff suppressed because one or more lines are too long
@ -10,6 +10,8 @@ from ..payments.supabase import Supabase
|
||||
|
||||
supabase = Supabase()
|
||||
logger = logging.getLogger(__name__)
|
||||
USER_ID = supabase.SUPABASE_TEST_USER_ID
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def client():
|
||||
@ -32,7 +34,7 @@ def test_turckheim(client, request): # pylint: disable=redefined-outer-name
|
||||
response = client.post(
|
||||
"/trip/new",
|
||||
json={
|
||||
"user_id": supabase.SUPABASE_TEST_USER_ID,
|
||||
"user_id": USER_ID,
|
||||
"preferences": {"sightseeing": {"type": "sightseeing", "score": 5},
|
||||
"nature": {"type": "nature", "score": 0},
|
||||
"shopping": {"type": "shopping", "score": 0},
|
||||
@ -44,8 +46,7 @@ def test_turckheim(client, request): # pylint: disable=redefined-outer-name
|
||||
}
|
||||
)
|
||||
result = response.json()
|
||||
logger.debug(f'API response : {result}')
|
||||
supabase.increment_credit_balance(user_id=supabase.SUPABASE_TEST_USER_ID)
|
||||
supabase.increment_credit_balance(user_id=USER_ID)
|
||||
landmarks = load_trip_landmarks(client, result['first_landmark_uuid'])
|
||||
|
||||
|
||||
@ -68,7 +69,7 @@ def test_turckheim(client, request): # pylint: disable=redefined-outer-name
|
||||
# assert 2!= 3
|
||||
|
||||
|
||||
'''
|
||||
|
||||
def test_bellecour(client, request) : # pylint: disable=redefined-outer-name
|
||||
"""
|
||||
Test n°2 : Custom test in Lyon centre to ensure proper decision making in crowded area.
|
||||
@ -84,7 +85,7 @@ def test_bellecour(client, request) : # pylint: disable=redefined-outer-name
|
||||
response = client.post(
|
||||
"/trip/new",
|
||||
json={
|
||||
"user_id": supabase.SUPABASE_TEST_USER_ID,
|
||||
"user_id": USER_ID,
|
||||
"preferences": {"sightseeing": {"type": "sightseeing", "score": 5},
|
||||
"nature": {"type": "nature", "score": 5},
|
||||
"shopping": {"type": "shopping", "score": 5},
|
||||
@ -94,7 +95,7 @@ def test_bellecour(client, request) : # pylint: disable=redefined-outer-name
|
||||
}
|
||||
)
|
||||
result = response.json()
|
||||
supabase.increment_credit_balance(user_id=supabase.SUPABASE_TEST_USER_ID)
|
||||
supabase.increment_credit_balance(user_id=USER_ID)
|
||||
landmarks = load_trip_landmarks(client, result['first_landmark_uuid'])
|
||||
|
||||
# Get computation time
|
||||
@ -126,7 +127,7 @@ def test_cologne(client, request) : # pylint: disable=redefined-outer-name
|
||||
response = client.post(
|
||||
"/trip/new",
|
||||
json={
|
||||
"user_id": supabase.SUPABASE_TEST_USER_ID,
|
||||
"user_id": USER_ID,
|
||||
"preferences": {"sightseeing": {"type": "sightseeing", "score": 5},
|
||||
"nature": {"type": "nature", "score": 5},
|
||||
"shopping": {"type": "shopping", "score": 5},
|
||||
@ -136,7 +137,7 @@ def test_cologne(client, request) : # pylint: disable=redefined-outer-name
|
||||
}
|
||||
)
|
||||
result = response.json()
|
||||
supabase.increment_credit_balance(user_id=supabase.SUPABASE_TEST_USER_ID)
|
||||
supabase.increment_credit_balance(user_id=USER_ID)
|
||||
landmarks = load_trip_landmarks(client, result['first_landmark_uuid'])
|
||||
|
||||
# Get computation time
|
||||
@ -169,7 +170,7 @@ def test_strasbourg(client, request) : # pylint: disable=redefined-outer-name
|
||||
response = client.post(
|
||||
"/trip/new",
|
||||
json={
|
||||
"user_id": supabase.SUPABASE_TEST_USER_ID,
|
||||
"user_id": USER_ID,
|
||||
"preferences": {"sightseeing": {"type": "sightseeing", "score": 5},
|
||||
"nature": {"type": "nature", "score": 5},
|
||||
"shopping": {"type": "shopping", "score": 5},
|
||||
@ -179,7 +180,7 @@ def test_strasbourg(client, request) : # pylint: disable=redefined-outer-name
|
||||
}
|
||||
)
|
||||
result = response.json()
|
||||
supabase.increment_credit_balance(user_id=supabase.SUPABASE_TEST_USER_ID)
|
||||
supabase.increment_credit_balance(user_id=USER_ID)
|
||||
landmarks = load_trip_landmarks(client, result['first_landmark_uuid'])
|
||||
|
||||
# Get computation time
|
||||
@ -212,7 +213,7 @@ def test_zurich(client, request) : # pylint: disable=redefined-outer-name
|
||||
response = client.post(
|
||||
"/trip/new",
|
||||
json={
|
||||
"user_id": supabase.SUPABASE_TEST_USER_ID,
|
||||
"user_id": USER_ID,
|
||||
"preferences": {"sightseeing": {"type": "sightseeing", "score": 5},
|
||||
"nature": {"type": "nature", "score": 5},
|
||||
"shopping": {"type": "shopping", "score": 5},
|
||||
@ -222,7 +223,7 @@ def test_zurich(client, request) : # pylint: disable=redefined-outer-name
|
||||
}
|
||||
)
|
||||
result = response.json()
|
||||
supabase.increment_credit_balance(user_id=supabase.SUPABASE_TEST_USER_ID)
|
||||
supabase.increment_credit_balance(user_id=USER_ID)
|
||||
landmarks = load_trip_landmarks(client, result['first_landmark_uuid'])
|
||||
|
||||
# Get computation time
|
||||
@ -255,7 +256,7 @@ def test_paris(client, request) : # pylint: disable=redefined-outer-name
|
||||
response = client.post(
|
||||
"/trip/new",
|
||||
json={
|
||||
"user_id": supabase.SUPABASE_TEST_USER_ID,
|
||||
"user_id": USER_ID,
|
||||
"preferences": {"sightseeing": {"type": "sightseeing", "score": 5},
|
||||
"nature": {"type": "nature", "score": 0},
|
||||
"shopping": {"type": "shopping", "score": 5},
|
||||
@ -265,7 +266,7 @@ def test_paris(client, request) : # pylint: disable=redefined-outer-name
|
||||
}
|
||||
)
|
||||
result = response.json()
|
||||
supabase.increment_credit_balance(user_id=supabase.SUPABASE_TEST_USER_ID)
|
||||
supabase.increment_credit_balance(user_id=USER_ID)
|
||||
landmarks = load_trip_landmarks(client, result['first_landmark_uuid'])
|
||||
|
||||
# Get computation time
|
||||
@ -298,7 +299,7 @@ def test_new_york(client, request) : # pylint: disable=redefined-outer-name
|
||||
response = client.post(
|
||||
"/trip/new",
|
||||
json={
|
||||
"user_id": supabase.SUPABASE_TEST_USER_ID,
|
||||
"user_id": USER_ID,
|
||||
"preferences": {"sightseeing": {"type": "sightseeing", "score": 5},
|
||||
"nature": {"type": "nature", "score": 5},
|
||||
"shopping": {"type": "shopping", "score": 5},
|
||||
@ -308,7 +309,7 @@ def test_new_york(client, request) : # pylint: disable=redefined-outer-name
|
||||
}
|
||||
)
|
||||
result = response.json()
|
||||
supabase.increment_credit_balance(user_id=supabase.SUPABASE_TEST_USER_ID)
|
||||
supabase.increment_credit_balance(user_id=USER_ID)
|
||||
landmarks = load_trip_landmarks(client, result['first_landmark_uuid'])
|
||||
|
||||
# Get computation time
|
||||
@ -341,7 +342,7 @@ def test_shopping(client, request) : # pylint: disable=redefined-outer-name
|
||||
response = client.post(
|
||||
"/trip/new",
|
||||
json={
|
||||
"user_id": supabase.SUPABASE_TEST_USER_ID,
|
||||
"user_id": USER_ID,
|
||||
"preferences": {"sightseeing": {"type": "sightseeing", "score": 0},
|
||||
"nature": {"type": "nature", "score": 0},
|
||||
"shopping": {"type": "shopping", "score": 5},
|
||||
@ -351,7 +352,7 @@ def test_shopping(client, request) : # pylint: disable=redefined-outer-name
|
||||
}
|
||||
)
|
||||
result = response.json()
|
||||
supabase.increment_credit_balance(user_id=supabase.SUPABASE_TEST_USER_ID)
|
||||
supabase.increment_credit_balance(user_id=USER_ID)
|
||||
landmarks = load_trip_landmarks(client, result['first_landmark_uuid'])
|
||||
|
||||
# Get computation time
|
||||
@ -368,4 +369,3 @@ def test_shopping(client, request) : # pylint: disable=redefined-outer-name
|
||||
assert comp_time < 30, f"Computation time exceeded 30 seconds: {comp_time:.2f} seconds"
|
||||
assert duration_minutes*0.8 < result['total_time'], f"Trip too short: {result['total_time']} instead of {duration_minutes}"
|
||||
assert duration_minutes*1.2 > result['total_time'], f"Trip too long: {result['total_time']} instead of {duration_minutes}"
|
||||
'''
|
Loading…
x
Reference in New Issue
Block a user