Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reuse fixtures in config flow tests for Whirlpool #136489

Merged
merged 2 commits into from
Jan 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 24 additions & 7 deletions tests/components/whirlpool/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,12 @@ def fixture_brand(request: pytest.FixtureRequest) -> tuple[str, Brand]:
@pytest.fixture(name="mock_auth_api")
def fixture_mock_auth_api():
"""Set up Auth fixture."""
with mock.patch("homeassistant.components.whirlpool.Auth") as mock_auth:
with (
mock.patch("homeassistant.components.whirlpool.Auth") as mock_auth,
mock.patch(
"homeassistant.components.whirlpool.config_flow.Auth", new=mock_auth
),
):
mock_auth.return_value.do_auth = AsyncMock()
mock_auth.return_value.is_access_token_valid.return_value = True
yield mock_auth
Expand All @@ -48,9 +53,15 @@ def fixture_mock_auth_api():
@pytest.fixture(name="mock_appliances_manager_api")
def fixture_mock_appliances_manager_api():
"""Set up AppliancesManager fixture."""
with mock.patch(
"homeassistant.components.whirlpool.AppliancesManager"
) as mock_appliances_manager:
with (
mock.patch(
"homeassistant.components.whirlpool.AppliancesManager"
) as mock_appliances_manager,
mock.patch(
"homeassistant.components.whirlpool.config_flow.AppliancesManager",
new=mock_appliances_manager,
),
):
mock_appliances_manager.return_value.fetch_appliances = AsyncMock()
mock_appliances_manager.return_value.aircons = [
{"SAID": MOCK_SAID1, "NAME": "TestZone"},
Expand Down Expand Up @@ -81,9 +92,15 @@ def fixture_mock_appliances_manager_laundry_api():
@pytest.fixture(name="mock_backend_selector_api")
def fixture_mock_backend_selector_api():
"""Set up BackendSelector fixture."""
with mock.patch(
"homeassistant.components.whirlpool.BackendSelector"
) as mock_backend_selector:
with (
mock.patch(
"homeassistant.components.whirlpool.BackendSelector"
) as mock_backend_selector,
mock.patch(
"homeassistant.components.whirlpool.config_flow.BackendSelector",
new=mock_backend_selector,
),
):
yield mock_backend_selector


Expand Down
Loading