tests: stop the cloud write test leaving a debounced refresh behind

A write schedules a debounced refresh, which polled through a fake session
that only implements post(), crashed on the missing get(), and left its timer
running past the end of the test. CI's lingering-timer check caught it; it
passed locally only by timing luck.

Stubbed the same way test_coordinator_send_command's fixture already does,
which is what this test should have copied to begin with.
This commit is contained in:
Marc Billow
2026-08-10 10:26:33 +00:00
parent bb20eea191
commit 9652a14f64
+8
View File
@@ -13,6 +13,7 @@ import asyncio
import contextlib
import json
from typing import Any, cast
from unittest.mock import AsyncMock
import cbor2
import pytest
@@ -164,7 +165,14 @@ async def test_selecting_a_named_program_writes_both_tokens(hass: HomeAssistant)
sent.append((path_segs, payload))
return 0x44, b""
def pace(self):
pass
coordinator._session = cast(Any, _FakeSession())
# Same shape as test_coordinator_send_command's fixture: a write schedules
# a debounced refresh, which would poll through this fake and leave its
# timer behind after the test.
coordinator.async_request_refresh = AsyncMock()
bound = next(b for b in coordinator.bound if b.desc.key == "cycle")
await coordinator.async_send_command(bound, "cloud:55")