mirror of
https://github.com/home-assistant/core.git
synced 2025-07-31 01:07:10 +00:00
Reset Reolink host Mock for every test
This commit is contained in:
parent
00199013e7
commit
b06d86d085
@ -71,6 +71,16 @@ def reolink_connect_class() -> Generator[MagicMock]:
|
|||||||
) as host_mock_class,
|
) as host_mock_class,
|
||||||
):
|
):
|
||||||
host_mock = host_mock_class.return_value
|
host_mock = host_mock_class.return_value
|
||||||
|
host_mock.baichuan = create_autospec(Baichuan)
|
||||||
|
yield host_mock_class
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def reolink_connect(
|
||||||
|
reolink_connect_class: MagicMock,
|
||||||
|
) -> Generator[MagicMock]:
|
||||||
|
"""Mock reolink connection."""
|
||||||
|
host_mock = reolink_connect_class.return_value
|
||||||
host_mock.get_host_data.return_value = None
|
host_mock.get_host_data.return_value = None
|
||||||
host_mock.get_states.return_value = None
|
host_mock.get_states.return_value = None
|
||||||
host_mock.supported.return_value = True
|
host_mock.supported.return_value = True
|
||||||
@ -142,7 +152,6 @@ def reolink_connect_class() -> Generator[MagicMock]:
|
|||||||
host_mock.recording_packing_time = "60 Minutes"
|
host_mock.recording_packing_time = "60 Minutes"
|
||||||
|
|
||||||
# Baichuan
|
# Baichuan
|
||||||
host_mock.baichuan = create_autospec(Baichuan)
|
|
||||||
host_mock.baichuan_only = False
|
host_mock.baichuan_only = False
|
||||||
# Disable tcp push by default for tests
|
# Disable tcp push by default for tests
|
||||||
host_mock.baichuan.port = TEST_BC_PORT
|
host_mock.baichuan.port = TEST_BC_PORT
|
||||||
@ -161,16 +170,7 @@ def reolink_connect_class() -> Generator[MagicMock]:
|
|||||||
host_mock.baichuan.smart_ai_type_list.return_value = ["people"]
|
host_mock.baichuan.smart_ai_type_list.return_value = ["people"]
|
||||||
host_mock.baichuan.smart_ai_index.return_value = 1
|
host_mock.baichuan.smart_ai_index.return_value = 1
|
||||||
host_mock.baichuan.smart_ai_name.return_value = "zone1"
|
host_mock.baichuan.smart_ai_name.return_value = "zone1"
|
||||||
|
return host_mock
|
||||||
yield host_mock_class
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
|
||||||
def reolink_connect(
|
|
||||||
reolink_connect_class: MagicMock,
|
|
||||||
) -> Generator[MagicMock]:
|
|
||||||
"""Mock reolink connection."""
|
|
||||||
return reolink_connect_class.return_value
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
|
Loading…
x
Reference in New Issue
Block a user