27 lines
975 B
Python
27 lines
975 B
Python
from datetime import date, time
|
|
|
|
from app_new.contracts.models import ContractVisit
|
|
|
|
|
|
def test_visit_modes_do_not_invent_an_hour():
|
|
visit = ContractVisit(scheduled_date=date(2026, 9, 12), passage_mode="date_only")
|
|
assert visit.start_time is None
|
|
assert visit.is_fixed_for_planning is False
|
|
assert visit.display_mode == "Date connue, heure inconnue"
|
|
|
|
|
|
def test_appointment_is_fixed_only_when_times_are_present():
|
|
visit = ContractVisit(
|
|
scheduled_date=date(2026, 9, 12), passage_mode="appointment",
|
|
start_time=time(9, 30), end_time=time(11, 0),
|
|
)
|
|
assert visit.is_fixed_for_planning is True
|
|
|
|
|
|
def test_open_window_is_not_a_fixed_planning_block():
|
|
visit = ContractVisit(
|
|
scheduled_date=date(2026, 9, 1), passage_mode="open_window",
|
|
window_start=date(2026, 9, 1), window_end=date(2026, 9, 15),
|
|
)
|
|
assert visit.is_fixed_for_planning is False
|
|
assert visit.display_mode == "Passage libre / sans rendez-vous"
|