Skip to content

Commit 0f112bb

Browse files
authored
Use non-autospec mock for Reolink service tests (home-assistant#147440)
1 parent 54e5107 commit 0f112bb

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

tests/components/reolink/test_services.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
async def test_play_chime_service_entity(
2121
hass: HomeAssistant,
2222
config_entry: MockConfigEntry,
23-
reolink_connect: MagicMock,
24-
test_chime: Chime,
23+
reolink_host: MagicMock,
24+
reolink_chime: Chime,
2525
entity_registry: er.EntityRegistry,
2626
) -> None:
2727
"""Test chime play service."""
@@ -37,14 +37,14 @@ async def test_play_chime_service_entity(
3737
device_id = entity.device_id
3838

3939
# Test chime play service with device
40-
test_chime.play = AsyncMock()
40+
reolink_chime.play = AsyncMock()
4141
await hass.services.async_call(
4242
DOMAIN,
4343
"play_chime",
4444
{ATTR_DEVICE_ID: [device_id], ATTR_RINGTONE: "attraction"},
4545
blocking=True,
4646
)
47-
test_chime.play.assert_called_once()
47+
reolink_chime.play.assert_called_once()
4848

4949
# Test errors
5050
with pytest.raises(ServiceValidationError):
@@ -55,7 +55,7 @@ async def test_play_chime_service_entity(
5555
blocking=True,
5656
)
5757

58-
test_chime.play = AsyncMock(side_effect=ReolinkError("Test error"))
58+
reolink_chime.play = AsyncMock(side_effect=ReolinkError("Test error"))
5959
with pytest.raises(HomeAssistantError):
6060
await hass.services.async_call(
6161
DOMAIN,
@@ -64,7 +64,7 @@ async def test_play_chime_service_entity(
6464
blocking=True,
6565
)
6666

67-
test_chime.play = AsyncMock(side_effect=InvalidParameterError("Test error"))
67+
reolink_chime.play = AsyncMock(side_effect=InvalidParameterError("Test error"))
6868
with pytest.raises(ServiceValidationError):
6969
await hass.services.async_call(
7070
DOMAIN,
@@ -73,7 +73,7 @@ async def test_play_chime_service_entity(
7373
blocking=True,
7474
)
7575

76-
reolink_connect.chime.return_value = None
76+
reolink_host.chime.return_value = None
7777
with pytest.raises(ServiceValidationError):
7878
await hass.services.async_call(
7979
DOMAIN,
@@ -86,8 +86,8 @@ async def test_play_chime_service_entity(
8686
async def test_play_chime_service_unloaded(
8787
hass: HomeAssistant,
8888
config_entry: MockConfigEntry,
89-
reolink_connect: MagicMock,
90-
test_chime: Chime,
89+
reolink_host: MagicMock,
90+
reolink_chime: Chime,
9191
entity_registry: er.EntityRegistry,
9292
) -> None:
9393
"""Test chime play service when config entry is unloaded."""

0 commit comments

Comments
 (0)