test: update integration tests for motor vehicle selection
This commit is contained in:
@@ -20,7 +20,8 @@ def test_create_entry(client, app):
|
||||
response = client.post("/entries/new", data={
|
||||
"date": "2025-06-02",
|
||||
"day_type": "WORK",
|
||||
"journey_profile_id": "voiture_seule",
|
||||
"journey_profile_id": "moteur_seul",
|
||||
"motor_vehicle_id": "familiale",
|
||||
"start_time": ["09:00"],
|
||||
"end_time": ["17:45"],
|
||||
"comment": "",
|
||||
@@ -34,6 +35,7 @@ def test_create_entry(client, app):
|
||||
assert entry is not None
|
||||
assert entry.day_type == "WORK"
|
||||
assert len(entry.time_slots) == 1
|
||||
assert entry.motor_vehicle_id == "familiale"
|
||||
|
||||
|
||||
def test_entry_list(client, app):
|
||||
@@ -68,3 +70,24 @@ def test_delete_entry(client, app):
|
||||
sa.select(WorkEntry).where(WorkEntry.id == entry_id)
|
||||
)
|
||||
assert deleted is None
|
||||
|
||||
|
||||
def test_create_entry_velo_no_motor_vehicle(client, app):
|
||||
"""Un trajet vélo seul ne doit pas enregistrer de motor_vehicle_id."""
|
||||
response = client.post("/entries/new", data={
|
||||
"date": "2025-06-10",
|
||||
"day_type": "WORK",
|
||||
"journey_profile_id": "velo_seul",
|
||||
"motor_vehicle_id": "",
|
||||
"start_time": ["08:30"],
|
||||
"end_time": ["17:00"],
|
||||
"comment": "",
|
||||
}, follow_redirects=True)
|
||||
assert response.status_code == 200
|
||||
|
||||
with app.app_context():
|
||||
entry = db.session.scalar(
|
||||
sa.select(WorkEntry).where(WorkEntry.date == date(2025, 6, 10))
|
||||
)
|
||||
assert entry is not None
|
||||
assert entry.motor_vehicle_id is None
|
||||
|
||||
Reference in New Issue
Block a user