feat: add get_motor_vehicles() and journey_has_motor() to config_loader
This commit is contained in:
@@ -2,16 +2,40 @@ def test_get_vehicles_returns_configured_vehicles(app):
|
||||
with app.app_context():
|
||||
from app.config_loader import get_vehicles
|
||||
vehicles = get_vehicles()
|
||||
assert "voiture" in vehicles
|
||||
assert vehicles["voiture"]["co2_per_km"] == 142
|
||||
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 "voiture_seule" in journeys
|
||||
assert journeys["voiture_seule"]["distances"]["voiture"] == 25
|
||||
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):
|
||||
|
||||
Reference in New Issue
Block a user