Modernize Twentemilieu tests (#88640)

This commit is contained in:
Franck Nijhof 2023-02-23 16:26:17 +01:00 committed by GitHub
parent f8314fe007
commit 6112793b19
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 639 additions and 192 deletions

View file

@ -46,22 +46,14 @@ def mock_setup_entry() -> Generator[None, None, None]:
@pytest.fixture
def mock_twentemilieu_config_flow() -> Generator[None, MagicMock, None]:
"""Return a mocked Twente Milieu client."""
with patch(
"homeassistant.components.twentemilieu.config_flow.TwenteMilieu", autospec=True
) as twentemilieu_mock:
twentemilieu = twentemilieu_mock.return_value
twentemilieu.unique_id.return_value = 12345
yield twentemilieu
@pytest.fixture
def mock_twentemilieu() -> Generator[None, MagicMock, None]:
def mock_twentemilieu() -> Generator[MagicMock, None, None]:
"""Return a mocked Twente Milieu client."""
with patch(
"homeassistant.components.twentemilieu.TwenteMilieu", autospec=True
) as twentemilieu_mock:
) as twentemilieu_mock, patch(
"homeassistant.components.twentemilieu.config_flow.TwenteMilieu",
new=twentemilieu_mock,
):
twentemilieu = twentemilieu_mock.return_value
twentemilieu.unique_id.return_value = 12345
twentemilieu.update.return_value = {