Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion products/today/backend/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ def test_no_briefing_and_no_row_for_people_who_may_not_get_one(

def test_first_open_creates_one_briefing_and_starts_generation_once(self, sync_connect: MagicMock) -> None:
sync_connect.return_value.start_workflow = AsyncMock()
with self._flag(True):
# At noon UTC it is past eight in Prague and in the project's UTC, so both calls read the same briefing day.
with self._flag(True), time_machine.travel(datetime(2026, 9, 30, 12, 0, tzinfo=UTC), tick=False):
first = self.client.get(f"/api/projects/{self.team.id}/today/briefing/?timezone=Europe/Prague")
# An MCP call sends no timezone; it must not move the person's mornings to the project's.
second = self.client.get(f"/api/projects/{self.team.id}/today/briefing/")
Expand Down Expand Up @@ -87,10 +88,13 @@ def test_the_briefing_day_starts_at_eight(self, sync_connect: MagicMock) -> None
early = self.client.get(url).json()
with time_machine.travel(datetime(2026, 9, 30, 7, 0, tzinfo=UTC), tick=False):
today = self.client.get(url).json()
# A call without a timezone uses the project's UTC, where it is still before eight.
without_timezone = self.client.get(f"/api/projects/{self.team.id}/today/briefing/").json()

assert early["local_day"] == "2026-09-29"
assert today["local_day"] == "2026-09-30"
assert early["id"] != today["id"]
assert without_timezone["id"] == early["id"]
assert sync_connect.return_value.start_workflow.call_count == 2

def test_a_refresh_while_one_is_being_written_starts_nothing_new(self, sync_connect: MagicMock) -> None:
Expand Down
Loading