55 lines
1.7 KiB
Python
55 lines
1.7 KiB
Python
def test_get_vehicles_returns_configured_vehicles(app):
|
|
with app.app_context():
|
|
from app.config_loader import get_vehicles
|
|
vehicles = get_vehicles()
|
|
assert "familiale" in vehicles
|
|
assert vehicles["familiale"]["co2_per_km"] == 142
|
|
|
|
|
|
def test_get_motor_vehicles_excludes_velo(app):
|
|
with app.app_context():
|
|
from app.config_loader import get_motor_vehicles
|
|
motor = get_motor_vehicles()
|
|
assert "familiale" in motor
|
|
assert "citadine" in motor
|
|
assert "moto" in motor
|
|
assert "velo" not in motor
|
|
|
|
|
|
def test_get_journeys_returns_profiles(app):
|
|
with app.app_context():
|
|
from app.config_loader import get_journeys
|
|
journeys = get_journeys()
|
|
assert "moteur_seul" in journeys
|
|
assert journeys["moteur_seul"]["distances"]["moteur"] == 25
|
|
|
|
|
|
def test_journey_has_motor_true(app):
|
|
with app.app_context():
|
|
from app.config_loader import journey_has_motor
|
|
assert journey_has_motor("moteur_seul") is True
|
|
assert journey_has_motor("moteur_velo") is True
|
|
|
|
|
|
def test_journey_has_motor_false(app):
|
|
with app.app_context():
|
|
from app.config_loader import journey_has_motor
|
|
assert journey_has_motor("velo_seul") is False
|
|
assert journey_has_motor(None) is False
|
|
|
|
|
|
def test_get_bareme_returns_tranches(app):
|
|
with app.app_context():
|
|
from app.config_loader import get_bareme
|
|
tranches = get_bareme(2025, 5)
|
|
assert len(tranches) == 3
|
|
assert tranches[0]["taux"] == 0.548
|
|
|
|
|
|
def test_day_types_without_journey(app):
|
|
with app.app_context():
|
|
from app.config_loader import day_types_without_journey
|
|
types = day_types_without_journey()
|
|
assert "TT" in types
|
|
assert "WORK" not in types
|