@@ -21,11 +21,11 @@ async def test_motion_sensor(
2121 hass_client_no_auth : ClientSessionGenerator ,
2222 freezer : FrozenDateTimeFactory ,
2323 config_entry : MockConfigEntry ,
24- reolink_connect : MagicMock ,
24+ reolink_host : MagicMock ,
2525) -> None :
2626 """Test binary sensor entity with motion sensor."""
27- reolink_connect .model = TEST_DUO_MODEL
28- reolink_connect .motion_detected .return_value = True
27+ reolink_host .model = TEST_DUO_MODEL
28+ reolink_host .motion_detected .return_value = True
2929 with patch ("homeassistant.components.reolink.PLATFORMS" , [Platform .BINARY_SENSOR ]):
3030 assert await hass .config_entries .async_setup (config_entry .entry_id )
3131 await hass .async_block_till_done ()
@@ -34,16 +34,16 @@ async def test_motion_sensor(
3434 entity_id = f"{ Platform .BINARY_SENSOR } .{ TEST_NVR_NAME } _motion_lens_0"
3535 assert hass .states .get (entity_id ).state == STATE_ON
3636
37- reolink_connect .motion_detected .return_value = False
37+ reolink_host .motion_detected .return_value = False
3838 freezer .tick (DEVICE_UPDATE_INTERVAL )
3939 async_fire_time_changed (hass )
4040 await hass .async_block_till_done ()
4141
4242 assert hass .states .get (entity_id ).state == STATE_OFF
4343
4444 # test ONVIF webhook callback
45- reolink_connect .motion_detected .return_value = True
46- reolink_connect .ONVIF_event_callback .return_value = [0 ]
45+ reolink_host .motion_detected .return_value = True
46+ reolink_host .ONVIF_event_callback .return_value = [0 ]
4747 webhook_id = config_entry .runtime_data .host .webhook_id
4848 client = await hass_client_no_auth ()
4949 await client .post (f"/api/webhook/{ webhook_id } " , data = "test_data" )
@@ -56,11 +56,11 @@ async def test_smart_ai_sensor(
5656 hass_client_no_auth : ClientSessionGenerator ,
5757 freezer : FrozenDateTimeFactory ,
5858 config_entry : MockConfigEntry ,
59- reolink_connect : MagicMock ,
59+ reolink_host : MagicMock ,
6060) -> None :
6161 """Test smart ai binary sensor entity."""
62- reolink_connect .model = TEST_HOST_MODEL
63- reolink_connect .baichuan .smart_ai_state .return_value = True
62+ reolink_host .model = TEST_HOST_MODEL
63+ reolink_host .baichuan .smart_ai_state .return_value = True
6464 with patch ("homeassistant.components.reolink.PLATFORMS" , [Platform .BINARY_SENSOR ]):
6565 assert await hass .config_entries .async_setup (config_entry .entry_id )
6666 await hass .async_block_till_done ()
@@ -69,7 +69,7 @@ async def test_smart_ai_sensor(
6969 entity_id = f"{ Platform .BINARY_SENSOR } .{ TEST_NVR_NAME } _crossline_zone1_person"
7070 assert hass .states .get (entity_id ).state == STATE_ON
7171
72- reolink_connect .baichuan .smart_ai_state .return_value = False
72+ reolink_host .baichuan .smart_ai_state .return_value = False
7373 freezer .tick (DEVICE_UPDATE_INTERVAL )
7474 async_fire_time_changed (hass )
7575 await hass .async_block_till_done ()
@@ -80,7 +80,7 @@ async def test_smart_ai_sensor(
8080async def test_tcp_callback (
8181 hass : HomeAssistant ,
8282 config_entry : MockConfigEntry ,
83- reolink_connect : MagicMock ,
83+ reolink_host : MagicMock ,
8484) -> None :
8585 """Test tcp callback using motion sensor."""
8686
@@ -95,11 +95,11 @@ def register_callback(
9595
9696 callback_mock = callback_mock_class ()
9797
98- reolink_connect .model = TEST_HOST_MODEL
99- reolink_connect .baichuan .events_active = True
100- reolink_connect .baichuan .subscribe_events .reset_mock (side_effect = True )
101- reolink_connect .baichuan .register_callback = callback_mock .register_callback
102- reolink_connect .motion_detected .return_value = True
98+ reolink_host .model = TEST_HOST_MODEL
99+ reolink_host .baichuan .events_active = True
100+ reolink_host .baichuan .subscribe_events .reset_mock (side_effect = True )
101+ reolink_host .baichuan .register_callback = callback_mock .register_callback
102+ reolink_host .motion_detected .return_value = True
103103
104104 with patch ("homeassistant.components.reolink.PLATFORMS" , [Platform .BINARY_SENSOR ]):
105105 assert await hass .config_entries .async_setup (config_entry .entry_id )
@@ -110,7 +110,7 @@ def register_callback(
110110 assert hass .states .get (entity_id ).state == STATE_ON
111111
112112 # simulate a TCP push callback
113- reolink_connect .motion_detected .return_value = False
113+ reolink_host .motion_detected .return_value = False
114114 assert callback_mock .callback_func is not None
115115 callback_mock .callback_func ()
116116
0 commit comments