|
@@ -177,7 +177,7 @@ def test_override_data_with_next():
|
|
|
# reservation_diff
|
|
# reservation_diff
|
|
|
# ---------------------------------------------------------------------------
|
|
# ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
-def _res(checkin_h: int, checkout_h: int, *, wifi_key="key", wifi_ssid="ssid") -> ReservationData:
|
|
|
|
|
|
|
+def _res(checkin_h: int, checkout_h: int, *, wifi_key="key", wifi_ssid="ssid", door_code=None) -> ReservationData:
|
|
|
"""Build a reservation on 2026-07-01 with given check-in/out hours."""
|
|
"""Build a reservation on 2026-07-01 with given check-in/out hours."""
|
|
|
return ReservationData(
|
|
return ReservationData(
|
|
|
guest_name="Guest",
|
|
guest_name="Guest",
|
|
@@ -187,6 +187,7 @@ def _res(checkin_h: int, checkout_h: int, *, wifi_key="key", wifi_ssid="ssid") -
|
|
|
check_out_time=time(checkout_h, 0),
|
|
check_out_time=time(checkout_h, 0),
|
|
|
wifi_ssid=wifi_ssid,
|
|
wifi_ssid=wifi_ssid,
|
|
|
wifi_key=wifi_key,
|
|
wifi_key=wifi_key,
|
|
|
|
|
+ door_code=door_code,
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
@@ -244,10 +245,28 @@ def test_diff_same_window_wifi_key_changed():
|
|
|
new = _res(14, 20, wifi_key="new-key")
|
|
new = _res(14, 20, wifi_key="new-key")
|
|
|
diff = reservation_diff(old, new, _DURING)
|
|
diff = reservation_diff(old, new, _DURING)
|
|
|
assert diff.wifi_key_changed
|
|
assert diff.wifi_key_changed
|
|
|
|
|
+ assert not diff.door_code_changed
|
|
|
assert not diff.checkin_needed
|
|
assert not diff.checkin_needed
|
|
|
assert not diff.checkout_needed
|
|
assert not diff.checkout_needed
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+def test_diff_same_window_door_code_changed():
|
|
|
|
|
+ old = _res(14, 20, door_code="1234")
|
|
|
|
|
+ new = _res(14, 20, door_code="5678")
|
|
|
|
|
+ diff = reservation_diff(old, new, _DURING)
|
|
|
|
|
+ assert diff.door_code_changed
|
|
|
|
|
+ assert not diff.wifi_key_changed
|
|
|
|
|
+ assert not diff.checkin_needed
|
|
|
|
|
+ assert not diff.checkout_needed
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+def test_diff_same_window_no_change():
|
|
|
|
|
+ old = _res(14, 20, wifi_key="key", door_code="1234")
|
|
|
|
|
+ new = _res(14, 20, wifi_key="key", door_code="1234")
|
|
|
|
|
+ diff = reservation_diff(old, new, _DURING)
|
|
|
|
|
+ assert not diff.has_changes
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
def test_diff_different_window_both_active_returns_checkout_and_checkin():
|
|
def test_diff_different_window_both_active_returns_checkout_and_checkin():
|
|
|
old = ReservationData(
|
|
old = ReservationData(
|
|
|
check_in_date=date(2026, 7, 1), check_in_time=time(14, 0),
|
|
check_in_date=date(2026, 7, 1), check_in_time=time(14, 0),
|