Tie coordinator wrapper to snapshot builder; single clock read
build_snapshot now takes now ONLY and derives today = now.date() inside (P3-1): a single source of truth so the calendar date and wall-clock time can never disagree across two reads. Coordinator call site updated. The expected completed_at in tests/test_core_snapshot.py is now built from pinned_now.astimezone(datetime.timezone.utc).isoformat() instead of a literal '+00:00' UTC string (P3-2), so the assertion is timezone-independent rather than relying on the hass fixture's UTC timezone. Pin the coordinator's clock to pinned_now, run async_refresh, and assert coordinator.data == built (the frozen dataclasses make == a full deep compare) — the REQUIRED tie-in that proves the coordinator wrapper actually delegates to build_snapshot, which the literal assertions alone could not (P2).
This commit is contained in:
@@ -117,7 +117,6 @@ class NestQuestCoordinator(DataUpdateCoordinator):
|
||||
|
||||
async def _async_update_data(self) -> NestQuestSnapshot:
|
||||
now = self._local_now()
|
||||
today = now.date()
|
||||
return await build_snapshot(
|
||||
self.database, self.settings, today, now
|
||||
self.database, self.settings, now
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user