Skip to content

Commit af5e307

Browse files
authored
Fix schedule public availability test (#1357)
1 parent b2511ce commit af5e307

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

backend/test/integration/test_schedule.py

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -533,28 +533,30 @@ def get_busy_time(self, remote_calendar_ids, start, end):
533533
monkeypatch.setattr(CalDavConnector, 'get_busy_time', MockCaldavConnector.get_busy_time)
534534

535535
start_date = date(2024, 3, 1)
536-
start_time = time(16, tzinfo=UTC)
536+
start_time = time(17, tzinfo=UTC)
537537
# Next day
538-
end_time = time(0, tzinfo=UTC)
538+
end_time = time(1, tzinfo=UTC)
539539

540540
subscriber = make_pro_subscriber()
541541
generated_calendar = make_caldav_calendar(subscriber.id, connected=True)
542-
make_schedule(
543-
calendar_id=generated_calendar.id,
544-
active=True,
545-
start_date=start_date,
546-
start_time=start_time,
547-
end_time=end_time,
548-
end_date=None,
549-
earliest_booking=1440,
550-
farthest_booking=20160,
551-
slot_duration=30,
552-
)
553-
554542
signed_url = signed_url_by_subscriber(subscriber)
555543

556544
# Check availability at the start of the schedule
557545
with freeze_time(start_date):
546+
# We create the schedule inside the freeze_time block to ensure the time_updated
547+
# is set to a known date (PST) so start_time_local calculation is deterministic.
548+
make_schedule(
549+
calendar_id=generated_calendar.id,
550+
active=True,
551+
start_date=start_date,
552+
start_time=start_time,
553+
end_time=end_time,
554+
end_date=None,
555+
earliest_booking=1440,
556+
farthest_booking=20160,
557+
slot_duration=30,
558+
)
559+
558560
response = with_client.post(
559561
'/schedule/public/availability',
560562
json={'url': signed_url},

0 commit comments

Comments
 (0)