mirror of
https://github.com/home-assistant/core.git
synced 2025-09-05 21:01:37 +02:00
Use camera name in Reolink tests (#150555)
This commit is contained in:
@@ -43,7 +43,6 @@ TEST_PORT = 1234
|
||||
TEST_NVR_NAME = "test_reolink_name"
|
||||
TEST_CAM_NAME = "test_reolink_cam"
|
||||
TEST_NVR_NAME2 = "test2_reolink_name"
|
||||
TEST_CAM_NAME = "test_reolink_cam"
|
||||
TEST_USE_HTTPS = True
|
||||
TEST_HOST_MODEL = "RLN8-410"
|
||||
TEST_ITEM_NUMBER = "P000"
|
||||
@@ -117,7 +116,7 @@ def _init_host_mock(host_mock: MagicMock) -> None:
|
||||
host_mock.supported.return_value = True
|
||||
host_mock.item_number.return_value = TEST_ITEM_NUMBER
|
||||
host_mock.camera_model.return_value = TEST_CAM_MODEL
|
||||
host_mock.camera_name.return_value = TEST_NVR_NAME
|
||||
host_mock.camera_name.return_value = TEST_CAM_NAME
|
||||
host_mock.camera_hardware_version.return_value = "IPC_00001"
|
||||
host_mock.camera_sw_version.return_value = "v1.1.0.0.0.0000"
|
||||
host_mock.camera_sw_version_update_required.return_value = False
|
||||
|
@@ -10,7 +10,7 @@ from homeassistant.config_entries import ConfigEntryState
|
||||
from homeassistant.const import STATE_OFF, STATE_ON, Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from .conftest import TEST_DUO_MODEL, TEST_HOST_MODEL, TEST_NVR_NAME
|
||||
from .conftest import TEST_CAM_NAME, TEST_DUO_MODEL, TEST_HOST_MODEL
|
||||
|
||||
from tests.common import MockConfigEntry, async_fire_time_changed
|
||||
from tests.typing import ClientSessionGenerator
|
||||
@@ -31,7 +31,7 @@ async def test_motion_sensor(
|
||||
await hass.async_block_till_done()
|
||||
assert config_entry.state is ConfigEntryState.LOADED
|
||||
|
||||
entity_id = f"{Platform.BINARY_SENSOR}.{TEST_NVR_NAME}_motion_lens_0"
|
||||
entity_id = f"{Platform.BINARY_SENSOR}.{TEST_CAM_NAME}_motion_lens_0"
|
||||
assert hass.states.get(entity_id).state == STATE_ON
|
||||
|
||||
reolink_host.motion_detected.return_value = False
|
||||
@@ -66,7 +66,7 @@ async def test_smart_ai_sensor(
|
||||
await hass.async_block_till_done()
|
||||
assert config_entry.state is ConfigEntryState.LOADED
|
||||
|
||||
entity_id = f"{Platform.BINARY_SENSOR}.{TEST_NVR_NAME}_crossline_zone1_person"
|
||||
entity_id = f"{Platform.BINARY_SENSOR}.{TEST_CAM_NAME}_crossline_zone1_person"
|
||||
assert hass.states.get(entity_id).state == STATE_ON
|
||||
|
||||
reolink_host.baichuan.smart_ai_state.return_value = False
|
||||
@@ -106,7 +106,7 @@ async def test_tcp_callback(
|
||||
await hass.async_block_till_done()
|
||||
assert config_entry.state is ConfigEntryState.LOADED
|
||||
|
||||
entity_id = f"{Platform.BINARY_SENSOR}.{TEST_NVR_NAME}_motion"
|
||||
entity_id = f"{Platform.BINARY_SENSOR}.{TEST_CAM_NAME}_motion"
|
||||
assert hass.states.get(entity_id).state == STATE_ON
|
||||
|
||||
# simulate a TCP push callback
|
||||
|
@@ -13,7 +13,7 @@ from homeassistant.const import ATTR_ENTITY_ID, Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
|
||||
from .conftest import TEST_NVR_NAME
|
||||
from .conftest import TEST_CAM_NAME, TEST_NVR_NAME
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
@@ -29,7 +29,7 @@ async def test_button(
|
||||
await hass.async_block_till_done()
|
||||
assert config_entry.state is ConfigEntryState.LOADED
|
||||
|
||||
entity_id = f"{Platform.BUTTON}.{TEST_NVR_NAME}_ptz_up"
|
||||
entity_id = f"{Platform.BUTTON}.{TEST_CAM_NAME}_ptz_up"
|
||||
|
||||
await hass.services.async_call(
|
||||
BUTTON_DOMAIN,
|
||||
@@ -60,7 +60,7 @@ async def test_ptz_move_service(
|
||||
await hass.async_block_till_done()
|
||||
assert config_entry.state is ConfigEntryState.LOADED
|
||||
|
||||
entity_id = f"{Platform.BUTTON}.{TEST_NVR_NAME}_ptz_up"
|
||||
entity_id = f"{Platform.BUTTON}.{TEST_CAM_NAME}_ptz_up"
|
||||
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
|
@@ -15,7 +15,7 @@ from homeassistant.const import Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
|
||||
from .conftest import TEST_DUO_MODEL, TEST_NVR_NAME
|
||||
from .conftest import TEST_CAM_NAME, TEST_DUO_MODEL
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
from tests.typing import ClientSessionGenerator
|
||||
@@ -33,7 +33,7 @@ async def test_camera(
|
||||
await hass.async_block_till_done()
|
||||
assert config_entry.state is ConfigEntryState.LOADED
|
||||
|
||||
entity_id = f"{Platform.CAMERA}.{TEST_NVR_NAME}_fluent"
|
||||
entity_id = f"{Platform.CAMERA}.{TEST_CAM_NAME}_fluent"
|
||||
assert hass.states.get(entity_id).state == CameraState.IDLE
|
||||
|
||||
# check getting a image from the camera
|
||||
@@ -63,5 +63,5 @@ async def test_camera_no_stream_source(
|
||||
await hass.async_block_till_done()
|
||||
assert config_entry.state is ConfigEntryState.LOADED
|
||||
|
||||
entity_id = f"{Platform.CAMERA}.{TEST_NVR_NAME}_snapshots_fluent_lens_0"
|
||||
entity_id = f"{Platform.CAMERA}.{TEST_CAM_NAME}_snapshots_fluent_lens_0"
|
||||
assert hass.states.get(entity_id).state == CameraState.IDLE
|
||||
|
@@ -28,7 +28,7 @@ from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.helpers.network import NoURLAvailableError
|
||||
from homeassistant.util.aiohttp import MockRequest
|
||||
|
||||
from .conftest import TEST_NVR_NAME
|
||||
from .conftest import TEST_CAM_NAME
|
||||
|
||||
from tests.common import MockConfigEntry, async_fire_time_changed
|
||||
from tests.components.diagnostics import get_diagnostics_for_config_entry
|
||||
@@ -92,7 +92,7 @@ async def test_webhook_callback(
|
||||
await hass.async_block_till_done()
|
||||
assert config_entry.state is ConfigEntryState.LOADED
|
||||
|
||||
entity_id = f"{Platform.BINARY_SENSOR}.{TEST_NVR_NAME}_motion"
|
||||
entity_id = f"{Platform.BINARY_SENSOR}.{TEST_CAM_NAME}_motion"
|
||||
webhook_id = config_entry.runtime_data.host.webhook_id
|
||||
unique_id = config_entry.runtime_data.host.unique_id
|
||||
|
||||
|
@@ -52,6 +52,7 @@ from .conftest import (
|
||||
DEFAULT_PROTOCOL,
|
||||
TEST_BC_PORT,
|
||||
TEST_CAM_MODEL,
|
||||
TEST_CAM_NAME,
|
||||
TEST_HOST,
|
||||
TEST_HOST_MODEL,
|
||||
TEST_MAC,
|
||||
@@ -1034,7 +1035,7 @@ async def test_privacy_mode_change_callback(
|
||||
await hass.async_block_till_done()
|
||||
assert config_entry.state is ConfigEntryState.LOADED
|
||||
|
||||
entity_id = f"{Platform.SWITCH}.{TEST_NVR_NAME}_record_audio"
|
||||
entity_id = f"{Platform.SWITCH}.{TEST_CAM_NAME}_record_audio"
|
||||
assert hass.states.get(entity_id).state == STATE_UNAVAILABLE
|
||||
|
||||
# simulate a TCP push callback signaling a privacy mode change
|
||||
@@ -1106,7 +1107,7 @@ async def test_camera_wake_callback(
|
||||
await hass.async_block_till_done()
|
||||
assert config_entry.state is ConfigEntryState.LOADED
|
||||
|
||||
entity_id = f"{Platform.SWITCH}.{TEST_NVR_NAME}_record_audio"
|
||||
entity_id = f"{Platform.SWITCH}.{TEST_CAM_NAME}_record_audio"
|
||||
assert hass.states.get(entity_id).state == STATE_ON
|
||||
|
||||
reolink_host.sleeping.return_value = False
|
||||
|
@@ -17,7 +17,7 @@ from homeassistant.const import (
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
|
||||
from .conftest import TEST_NVR_NAME
|
||||
from .conftest import TEST_CAM_NAME, TEST_NVR_NAME
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
@@ -45,7 +45,7 @@ async def test_light_state(
|
||||
await hass.async_block_till_done()
|
||||
assert config_entry.state is ConfigEntryState.LOADED
|
||||
|
||||
entity_id = f"{Platform.LIGHT}.{TEST_NVR_NAME}_floodlight"
|
||||
entity_id = f"{Platform.LIGHT}.{TEST_CAM_NAME}_floodlight"
|
||||
|
||||
state = hass.states.get(entity_id)
|
||||
assert state.state == STATE_ON
|
||||
@@ -63,7 +63,7 @@ async def test_light_turn_off(
|
||||
await hass.async_block_till_done()
|
||||
assert config_entry.state is ConfigEntryState.LOADED
|
||||
|
||||
entity_id = f"{Platform.LIGHT}.{TEST_NVR_NAME}_floodlight"
|
||||
entity_id = f"{Platform.LIGHT}.{TEST_CAM_NAME}_floodlight"
|
||||
|
||||
await hass.services.async_call(
|
||||
LIGHT_DOMAIN,
|
||||
@@ -94,7 +94,7 @@ async def test_light_turn_on(
|
||||
await hass.async_block_till_done()
|
||||
assert config_entry.state is ConfigEntryState.LOADED
|
||||
|
||||
entity_id = f"{Platform.LIGHT}.{TEST_NVR_NAME}_floodlight"
|
||||
entity_id = f"{Platform.LIGHT}.{TEST_CAM_NAME}_floodlight"
|
||||
|
||||
await hass.services.async_call(
|
||||
LIGHT_DOMAIN,
|
||||
@@ -128,7 +128,7 @@ async def test_light_turn_on_errors(
|
||||
await hass.async_block_till_done()
|
||||
assert config_entry.state is ConfigEntryState.LOADED
|
||||
|
||||
entity_id = f"{Platform.LIGHT}.{TEST_NVR_NAME}_floodlight"
|
||||
entity_id = f"{Platform.LIGHT}.{TEST_CAM_NAME}_floodlight"
|
||||
|
||||
reolink_host.set_whiteled.side_effect = exception
|
||||
with pytest.raises(HomeAssistantError):
|
||||
|
@@ -34,10 +34,10 @@ from homeassistant.setup import async_setup_component
|
||||
|
||||
from .conftest import (
|
||||
TEST_BC_PORT,
|
||||
TEST_CAM_NAME,
|
||||
TEST_HOST2,
|
||||
TEST_HOST_MODEL,
|
||||
TEST_MAC2,
|
||||
TEST_NVR_NAME,
|
||||
TEST_NVR_NAME2,
|
||||
TEST_PASSWORD2,
|
||||
TEST_PORT,
|
||||
@@ -61,7 +61,6 @@ TEST_FILE_NAME = f"{TEST_START}00"
|
||||
TEST_FILE_NAME_MP4 = f"{TEST_START}00.mp4"
|
||||
TEST_STREAM = "main"
|
||||
TEST_CHANNEL = "0"
|
||||
TEST_CAM_NAME = "Cam new name"
|
||||
|
||||
TEST_MIME_TYPE = "application/x-mpegURL"
|
||||
TEST_MIME_TYPE_MP4 = "video/mp4"
|
||||
@@ -172,7 +171,7 @@ async def test_browsing(
|
||||
browse_res_AT_sub_id = f"RES|{entry_id}|{TEST_CHANNEL}|autotrack_sub"
|
||||
browse_res_AT_main_id = f"RES|{entry_id}|{TEST_CHANNEL}|autotrack_main"
|
||||
assert browse.domain == DOMAIN
|
||||
assert browse.title == f"{TEST_NVR_NAME} lens 0"
|
||||
assert browse.title == f"{TEST_CAM_NAME} lens 0"
|
||||
assert browse.identifier == browse_resolution_id
|
||||
assert browse.children[0].identifier == browse_res_sub_id
|
||||
assert browse.children[1].identifier == browse_res_main_id
|
||||
@@ -188,19 +187,19 @@ async def test_browsing(
|
||||
|
||||
browse = await async_browse_media(hass, f"{URI_SCHEME}{DOMAIN}/{browse_res_sub_id}")
|
||||
assert browse.domain == DOMAIN
|
||||
assert browse.title == f"{TEST_NVR_NAME} lens 0 Low res."
|
||||
assert browse.title == f"{TEST_CAM_NAME} lens 0 Low res."
|
||||
|
||||
browse = await async_browse_media(
|
||||
hass, f"{URI_SCHEME}{DOMAIN}/{browse_res_AT_sub_id}"
|
||||
)
|
||||
assert browse.domain == DOMAIN
|
||||
assert browse.title == f"{TEST_NVR_NAME} lens 0 Telephoto low res."
|
||||
assert browse.title == f"{TEST_CAM_NAME} lens 0 Telephoto low res."
|
||||
|
||||
browse = await async_browse_media(
|
||||
hass, f"{URI_SCHEME}{DOMAIN}/{browse_res_AT_main_id}"
|
||||
)
|
||||
assert browse.domain == DOMAIN
|
||||
assert browse.title == f"{TEST_NVR_NAME} lens 0 Telephoto high res."
|
||||
assert browse.title == f"{TEST_CAM_NAME} lens 0 Telephoto high res."
|
||||
|
||||
browse = await async_browse_media(
|
||||
hass, f"{URI_SCHEME}{DOMAIN}/{browse_res_main_id}"
|
||||
@@ -210,7 +209,7 @@ async def test_browsing(
|
||||
browse_day_0_id = f"DAY|{entry_id}|{TEST_CHANNEL}|{TEST_STREAM}|{TEST_YEAR}|{TEST_MONTH}|{TEST_DAY}"
|
||||
browse_day_1_id = f"DAY|{entry_id}|{TEST_CHANNEL}|{TEST_STREAM}|{TEST_YEAR}|{TEST_MONTH}|{TEST_DAY2}"
|
||||
assert browse.domain == DOMAIN
|
||||
assert browse.title == f"{TEST_NVR_NAME} lens 0 High res."
|
||||
assert browse.title == f"{TEST_CAM_NAME} lens 0 High res."
|
||||
assert browse.identifier == browse_days_id
|
||||
assert browse.children[0].identifier == browse_day_0_id
|
||||
assert browse.children[1].identifier == browse_day_1_id
|
||||
@@ -232,7 +231,7 @@ async def test_browsing(
|
||||
assert browse.domain == DOMAIN
|
||||
assert (
|
||||
browse.title
|
||||
== f"{TEST_NVR_NAME} lens 0 High res. {TEST_YEAR}/{TEST_MONTH}/{TEST_DAY}"
|
||||
== f"{TEST_CAM_NAME} lens 0 High res. {TEST_YEAR}/{TEST_MONTH}/{TEST_DAY}"
|
||||
)
|
||||
assert browse.identifier == browse_files_id
|
||||
assert browse.children[0].identifier == browse_file_id
|
||||
@@ -261,7 +260,7 @@ async def test_browsing(
|
||||
assert browse.domain == DOMAIN
|
||||
assert (
|
||||
browse.title
|
||||
== f"{TEST_NVR_NAME} High res. {TEST_YEAR}/{TEST_MONTH}/{TEST_DAY} Person"
|
||||
== f"{TEST_CAM_NAME} High res. {TEST_YEAR}/{TEST_MONTH}/{TEST_DAY} Person"
|
||||
)
|
||||
assert browse.identifier == browse_files_id
|
||||
assert browse.children[0].identifier == browse_file_id
|
||||
@@ -306,7 +305,7 @@ async def test_browsing_h265_encoding(
|
||||
browse_res_main_id = f"RES|{entry_id}|{TEST_CHANNEL}|main"
|
||||
|
||||
assert browse.domain == DOMAIN
|
||||
assert browse.title == f"{TEST_NVR_NAME}"
|
||||
assert browse.title == f"{TEST_CAM_NAME}"
|
||||
assert browse.identifier == browse_resolution_id
|
||||
assert browse.children[0].identifier == browse_res_sub_id
|
||||
assert browse.children[1].identifier == browse_res_main_id
|
||||
@@ -321,7 +320,7 @@ async def test_browsing_h265_encoding(
|
||||
f"DAY|{entry_id}|{TEST_CHANNEL}|sub|{TEST_YEAR}|{TEST_MONTH}|{TEST_DAY2}"
|
||||
)
|
||||
assert browse.domain == DOMAIN
|
||||
assert browse.title == f"{TEST_NVR_NAME} Low res."
|
||||
assert browse.title == f"{TEST_CAM_NAME} Low res."
|
||||
assert browse.identifier == browse_days_id
|
||||
assert browse.children[0].identifier == browse_day_0_id
|
||||
assert browse.children[1].identifier == browse_day_1_id
|
||||
|
@@ -16,7 +16,7 @@ from homeassistant.const import ATTR_ENTITY_ID, Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
|
||||
from .conftest import TEST_NVR_NAME
|
||||
from .conftest import TEST_CAM_NAME, TEST_NVR_NAME
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
@@ -34,7 +34,7 @@ async def test_number(
|
||||
await hass.async_block_till_done()
|
||||
assert config_entry.state is ConfigEntryState.LOADED
|
||||
|
||||
entity_id = f"{Platform.NUMBER}.{TEST_NVR_NAME}_volume"
|
||||
entity_id = f"{Platform.NUMBER}.{TEST_CAM_NAME}_volume"
|
||||
|
||||
assert hass.states.get(entity_id).state == "80"
|
||||
|
||||
@@ -79,7 +79,7 @@ async def test_smart_ai_number(
|
||||
await hass.async_block_till_done()
|
||||
assert config_entry.state is ConfigEntryState.LOADED
|
||||
|
||||
entity_id = f"{Platform.NUMBER}.{TEST_NVR_NAME}_AI_crossline_zone1_sensitivity"
|
||||
entity_id = f"{Platform.NUMBER}.{TEST_CAM_NAME}_AI_crossline_zone1_sensitivity"
|
||||
|
||||
assert hass.states.get(entity_id).state == "80"
|
||||
|
||||
|
@@ -20,7 +20,7 @@ from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import HomeAssistantError, ServiceValidationError
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
|
||||
from .conftest import TEST_NVR_NAME
|
||||
from .conftest import TEST_CAM_NAME, TEST_NVR_NAME
|
||||
|
||||
from tests.common import MockConfigEntry, async_fire_time_changed
|
||||
|
||||
@@ -38,7 +38,7 @@ async def test_floodlight_mode_select(
|
||||
await hass.async_block_till_done()
|
||||
assert config_entry.state is ConfigEntryState.LOADED
|
||||
|
||||
entity_id = f"{Platform.SELECT}.{TEST_NVR_NAME}_floodlight_mode"
|
||||
entity_id = f"{Platform.SELECT}.{TEST_CAM_NAME}_floodlight_mode"
|
||||
assert hass.states.get(entity_id).state == "auto"
|
||||
|
||||
await hass.services.async_call(
|
||||
@@ -88,7 +88,7 @@ async def test_play_quick_reply_message(
|
||||
await hass.async_block_till_done()
|
||||
assert config_entry.state is ConfigEntryState.LOADED
|
||||
|
||||
entity_id = f"{Platform.SELECT}.{TEST_NVR_NAME}_play_quick_reply_message"
|
||||
entity_id = f"{Platform.SELECT}.{TEST_CAM_NAME}_play_quick_reply_message"
|
||||
assert hass.states.get(entity_id).state == STATE_UNKNOWN
|
||||
|
||||
await hass.services.async_call(
|
||||
|
@@ -8,7 +8,7 @@ from homeassistant.config_entries import ConfigEntryState
|
||||
from homeassistant.const import STATE_UNAVAILABLE, Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from .conftest import TEST_NVR_NAME
|
||||
from .conftest import TEST_CAM_NAME, TEST_NVR_NAME
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
@@ -31,10 +31,10 @@ async def test_sensors(
|
||||
await hass.async_block_till_done()
|
||||
assert config_entry.state is ConfigEntryState.LOADED
|
||||
|
||||
entity_id = f"{Platform.SENSOR}.{TEST_NVR_NAME}_ptz_pan_position"
|
||||
entity_id = f"{Platform.SENSOR}.{TEST_CAM_NAME}_ptz_pan_position"
|
||||
assert hass.states.get(entity_id).state == "1200"
|
||||
|
||||
entity_id = f"{Platform.SENSOR}.{TEST_NVR_NAME}_wi_fi_signal"
|
||||
entity_id = f"{Platform.SENSOR}.{TEST_CAM_NAME}_wi_fi_signal"
|
||||
assert hass.states.get(entity_id).state == "-55"
|
||||
|
||||
entity_id = f"{Platform.SENSOR}.{TEST_NVR_NAME}_sd_0_storage"
|
||||
|
@@ -22,7 +22,7 @@ from homeassistant.const import (
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import HomeAssistantError, ServiceValidationError
|
||||
|
||||
from .conftest import TEST_NVR_NAME
|
||||
from .conftest import TEST_CAM_NAME
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
@@ -38,7 +38,7 @@ async def test_siren(
|
||||
await hass.async_block_till_done()
|
||||
assert config_entry.state is ConfigEntryState.LOADED
|
||||
|
||||
entity_id = f"{Platform.SIREN}.{TEST_NVR_NAME}_siren"
|
||||
entity_id = f"{Platform.SIREN}.{TEST_CAM_NAME}_siren"
|
||||
assert hass.states.get(entity_id).state == STATE_UNKNOWN
|
||||
|
||||
# test siren turn on
|
||||
@@ -98,7 +98,7 @@ async def test_siren_turn_on_errors(
|
||||
await hass.async_block_till_done()
|
||||
assert config_entry.state is ConfigEntryState.LOADED
|
||||
|
||||
entity_id = f"{Platform.SIREN}.{TEST_NVR_NAME}_siren"
|
||||
entity_id = f"{Platform.SIREN}.{TEST_CAM_NAME}_siren"
|
||||
|
||||
original = getattr(reolink_host, attr)
|
||||
setattr(reolink_host, attr, value)
|
||||
@@ -124,7 +124,7 @@ async def test_siren_turn_off_errors(
|
||||
await hass.async_block_till_done()
|
||||
assert config_entry.state is ConfigEntryState.LOADED
|
||||
|
||||
entity_id = f"{Platform.SIREN}.{TEST_NVR_NAME}_siren"
|
||||
entity_id = f"{Platform.SIREN}.{TEST_CAM_NAME}_siren"
|
||||
|
||||
reolink_host.set_siren.side_effect = ReolinkError("Test error")
|
||||
with pytest.raises(HomeAssistantError):
|
||||
|
@@ -36,7 +36,6 @@ async def test_switch(
|
||||
reolink_host: MagicMock,
|
||||
) -> None:
|
||||
"""Test switch entity."""
|
||||
reolink_host.camera_name.return_value = TEST_CAM_NAME
|
||||
reolink_host.audio_record.return_value = True
|
||||
|
||||
with patch("homeassistant.components.reolink.PLATFORMS", [Platform.SWITCH]):
|
||||
@@ -108,7 +107,6 @@ async def test_host_switch(
|
||||
reolink_host: MagicMock,
|
||||
) -> None:
|
||||
"""Test host switch entity."""
|
||||
reolink_host.camera_name.return_value = TEST_CAM_NAME
|
||||
reolink_host.email_enabled.return_value = True
|
||||
reolink_host.is_hub = False
|
||||
reolink_host.supported.return_value = True
|
||||
|
@@ -34,8 +34,6 @@ async def test_no_update(
|
||||
entity_name: str,
|
||||
) -> None:
|
||||
"""Test update state when no update available."""
|
||||
reolink_host.camera_name.return_value = TEST_CAM_NAME
|
||||
|
||||
with patch("homeassistant.components.reolink.PLATFORMS", [Platform.UPDATE]):
|
||||
assert await hass.config_entries.async_setup(config_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
@@ -53,7 +51,6 @@ async def test_update_str(
|
||||
entity_name: str,
|
||||
) -> None:
|
||||
"""Test update state when update available with string from API."""
|
||||
reolink_host.camera_name.return_value = TEST_CAM_NAME
|
||||
reolink_host.firmware_update_available.return_value = "New firmware available"
|
||||
|
||||
with patch("homeassistant.components.reolink.PLATFORMS", [Platform.UPDATE]):
|
||||
@@ -75,7 +72,6 @@ async def test_update_firm(
|
||||
entity_name: str,
|
||||
) -> None:
|
||||
"""Test update state when update available with firmware info from reolink.com."""
|
||||
reolink_host.camera_name.return_value = TEST_CAM_NAME
|
||||
reolink_host.sw_upload_progress.return_value = 100
|
||||
reolink_host.camera_sw_version.return_value = "v1.1.0.0.0.0000"
|
||||
new_firmware = NewSoftwareVersion(
|
||||
@@ -174,7 +170,6 @@ async def test_update_firm_keeps_available(
|
||||
entity_name: str,
|
||||
) -> None:
|
||||
"""Test update entity keeps being available during update."""
|
||||
reolink_host.camera_name.return_value = TEST_CAM_NAME
|
||||
reolink_host.camera_sw_version.return_value = "v1.1.0.0.0.0000"
|
||||
new_firmware = NewSoftwareVersion(
|
||||
version_string="v3.3.0.226_23031644",
|
||||
|
@@ -31,7 +31,7 @@ from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import HomeAssistantError, ServiceValidationError
|
||||
from homeassistant.helpers import device_registry as dr
|
||||
|
||||
from .conftest import TEST_NVR_NAME, TEST_UID, TEST_UID_CAM
|
||||
from .conftest import TEST_CAM_NAME, TEST_UID, TEST_UID_CAM
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
@@ -115,7 +115,7 @@ async def test_try_function(
|
||||
await hass.async_block_till_done()
|
||||
assert config_entry.state is ConfigEntryState.LOADED
|
||||
|
||||
entity_id = f"{Platform.NUMBER}.{TEST_NVR_NAME}_volume"
|
||||
entity_id = f"{Platform.NUMBER}.{TEST_CAM_NAME}_volume"
|
||||
|
||||
reolink_host.set_volume.side_effect = side_effect
|
||||
with pytest.raises(expected.__class__) as err:
|
||||
|
Reference in New Issue
Block a user