4141)
4242
4343
44- @pytest .mark .usefixtures ("current_request_with_host" )
44+ @pytest .mark .usefixtures ("current_request_with_host" , "mock_setup_entry" )
4545async def test_full_cloud_import_flow_multiple_devices (
4646 hass : HomeAssistant ,
4747 hass_client_no_auth : ClientSessionGenerator ,
4848 aioclient_mock : AiohttpClientMocker ,
49- mock_setup_entry : MagicMock ,
5049 mock_lametric_cloud : MagicMock ,
5150 mock_lametric : MagicMock ,
5251) -> None :
@@ -119,15 +118,13 @@ async def test_full_cloud_import_flow_multiple_devices(
119118 assert len (mock_lametric_cloud .devices .mock_calls ) == 1
120119 assert len (mock_lametric .device .mock_calls ) == 1
121120 assert len (mock_lametric .notify .mock_calls ) == 1
122- assert len (mock_setup_entry .mock_calls ) == 1
123121
124122
125- @pytest .mark .usefixtures ("current_request_with_host" )
123+ @pytest .mark .usefixtures ("current_request_with_host" , "mock_setup_entry" )
126124async def test_full_cloud_import_flow_single_device (
127125 hass : HomeAssistant ,
128126 hass_client_no_auth : ClientSessionGenerator ,
129127 aioclient_mock : AiohttpClientMocker ,
130- mock_setup_entry : MagicMock ,
131128 mock_lametric_cloud : MagicMock ,
132129 mock_lametric : MagicMock ,
133130) -> None :
@@ -198,12 +195,11 @@ async def test_full_cloud_import_flow_single_device(
198195 assert len (mock_lametric_cloud .devices .mock_calls ) == 1
199196 assert len (mock_lametric .device .mock_calls ) == 1
200197 assert len (mock_lametric .notify .mock_calls ) == 1
201- assert len (mock_setup_entry .mock_calls ) == 1
202198
203199
200+ @pytest .mark .usefixtures ("mock_setup_entry" )
204201async def test_full_manual (
205202 hass : HomeAssistant ,
206- mock_setup_entry : MagicMock ,
207203 mock_lametric : MagicMock ,
208204) -> None :
209205 """Check a full flow manual entry."""
@@ -246,15 +242,12 @@ async def test_full_manual(
246242 notification : Notification = mock_lametric .notify .mock_calls [0 ][2 ]["notification" ]
247243 assert notification .model .sound == Sound (sound = NotificationSound .WIN )
248244
249- assert len (mock_setup_entry .mock_calls ) == 1
250-
251245
252- @pytest .mark .usefixtures ("current_request_with_host" )
246+ @pytest .mark .usefixtures ("current_request_with_host" , "mock_setup_entry" )
253247async def test_full_ssdp_with_cloud_import (
254248 hass : HomeAssistant ,
255249 hass_client_no_auth : ClientSessionGenerator ,
256250 aioclient_mock : AiohttpClientMocker ,
257- mock_setup_entry : MagicMock ,
258251 mock_lametric_cloud : MagicMock ,
259252 mock_lametric : MagicMock ,
260253) -> None :
@@ -319,12 +312,11 @@ async def test_full_ssdp_with_cloud_import(
319312 assert len (mock_lametric_cloud .devices .mock_calls ) == 1
320313 assert len (mock_lametric .device .mock_calls ) == 1
321314 assert len (mock_lametric .notify .mock_calls ) == 1
322- assert len (mock_setup_entry .mock_calls ) == 1
323315
324316
317+ @pytest .mark .usefixtures ("mock_setup_entry" )
325318async def test_full_ssdp_manual_entry (
326319 hass : HomeAssistant ,
327- mock_setup_entry : MagicMock ,
328320 mock_lametric : MagicMock ,
329321) -> None :
330322 """Check a full flow triggered by SSDP, with manual API key entry."""
@@ -361,7 +353,6 @@ async def test_full_ssdp_manual_entry(
361353
362354 assert len (mock_lametric .device .mock_calls ) == 1
363355 assert len (mock_lametric .notify .mock_calls ) == 1
364- assert len (mock_setup_entry .mock_calls ) == 1
365356
366357
367358@pytest .mark .parametrize (
@@ -549,6 +540,7 @@ async def test_cloud_abort_no_devices(
549540 assert len (mock_lametric_cloud .devices .mock_calls ) == 1
550541
551542
543+ @pytest .mark .usefixtures ("mock_setup_entry" )
552544@pytest .mark .parametrize (
553545 ("side_effect" , "reason" ),
554546 [
@@ -561,7 +553,6 @@ async def test_cloud_abort_no_devices(
561553async def test_manual_errors (
562554 hass : HomeAssistant ,
563555 mock_lametric : MagicMock ,
564- mock_setup_entry : MagicMock ,
565556 side_effect : Exception ,
566557 reason : str ,
567558) -> None :
@@ -586,7 +577,6 @@ async def test_manual_errors(
586577
587578 assert len (mock_lametric .device .mock_calls ) == 1
588579 assert len (mock_lametric .notify .mock_calls ) == 0
589- assert len (mock_setup_entry .mock_calls ) == 0
590580
591581 mock_lametric .device .side_effect = None
592582 result = await hass .config_entries .flow .async_configure (
@@ -608,10 +598,9 @@ async def test_manual_errors(
608598
609599 assert len (mock_lametric .device .mock_calls ) == 2
610600 assert len (mock_lametric .notify .mock_calls ) == 1
611- assert len (mock_setup_entry .mock_calls ) == 1
612601
613602
614- @pytest .mark .usefixtures ("current_request_with_host" )
603+ @pytest .mark .usefixtures ("current_request_with_host" , "mock_setup_entry" )
615604@pytest .mark .parametrize (
616605 ("side_effect" , "reason" ),
617606 [
@@ -625,7 +614,6 @@ async def test_cloud_errors(
625614 hass : HomeAssistant ,
626615 hass_client_no_auth : ClientSessionGenerator ,
627616 aioclient_mock : AiohttpClientMocker ,
628- mock_setup_entry : MagicMock ,
629617 mock_lametric_cloud : MagicMock ,
630618 mock_lametric : MagicMock ,
631619 side_effect : Exception ,
@@ -672,7 +660,6 @@ async def test_cloud_errors(
672660 assert len (mock_lametric_cloud .devices .mock_calls ) == 1
673661 assert len (mock_lametric .device .mock_calls ) == 1
674662 assert len (mock_lametric .notify .mock_calls ) == 0
675- assert len (mock_setup_entry .mock_calls ) == 0
676663
677664 mock_lametric .device .side_effect = None
678665 result = await hass .config_entries .flow .async_configure (
@@ -694,7 +681,6 @@ async def test_cloud_errors(
694681 assert len (mock_lametric_cloud .devices .mock_calls ) == 1
695682 assert len (mock_lametric .device .mock_calls ) == 2
696683 assert len (mock_lametric .notify .mock_calls ) == 1
697- assert len (mock_setup_entry .mock_calls ) == 1
698684
699685
700686async def test_dhcp_discovery_updates_entry (
0 commit comments