Small cleanup in conftest mocks of PVOutput (#103628)

This commit is contained in:
Franck Nijhof 2023-11-08 01:09:44 +01:00 committed by GitHub
parent 91ffe4f9e5
commit 3e204ab82b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 32 deletions

View file

@ -34,21 +34,14 @@ def mock_setup_entry() -> Generator[AsyncMock, None, None]:
yield mock_setup
@pytest.fixture
def mock_pvoutput_config_flow() -> Generator[None, MagicMock, None]:
"""Return a mocked PVOutput client."""
with patch(
"homeassistant.components.pvoutput.config_flow.PVOutput", autospec=True
) as pvoutput_mock:
yield pvoutput_mock.return_value
@pytest.fixture
def mock_pvoutput() -> Generator[None, MagicMock, None]:
"""Return a mocked PVOutput client."""
with patch(
"homeassistant.components.pvoutput.coordinator.PVOutput", autospec=True
) as pvoutput_mock:
) as pvoutput_mock, patch(
"homeassistant.components.pvoutput.config_flow.PVOutput", new=pvoutput_mock
):
pvoutput = pvoutput_mock.return_value
pvoutput.status.return_value = Status.from_dict(
load_json_object_fixture("status.json", DOMAIN)