Remove unused fixtures in UniFi tests (#122628)

This commit is contained in:
Robert Svensson 2024-07-26 09:48:12 +02:00 committed by GitHub
parent 621bd5f0c3
commit 51d5e21203
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 8 additions and 16 deletions

View file

@ -295,7 +295,7 @@ async def fixture_config_entry_factory(
@pytest.fixture(name="config_entry_setup")
async def fixture_config_entry_setup(
hass: HomeAssistant, config_entry_factory: Callable[[], ConfigEntry]
config_entry_factory: Callable[[], ConfigEntry],
) -> ConfigEntry:
"""Fixture providing a set up instance of UniFi network integration."""
return await config_entry_factory()

View file

@ -37,7 +37,6 @@ from homeassistant.core import HomeAssistant
from homeassistant.data_entry_flow import FlowResultType
from tests.common import MockConfigEntry
from tests.test_util.aiohttp import AiohttpClientMocker
CLIENTS = [{"mac": "00:00:00:00:00:01"}]
@ -137,9 +136,7 @@ async def test_flow_works(hass: HomeAssistant, mock_discovery) -> None:
}
async def test_flow_works_negative_discovery(
hass: HomeAssistant, aioclient_mock: AiohttpClientMocker
) -> None:
async def test_flow_works_negative_discovery(hass: HomeAssistant) -> None:
"""Test config flow with a negative outcome of async_discovery_unifi."""
result = await hass.config_entries.flow.async_init(
UNIFI_DOMAIN, context={"source": config_entries.SOURCE_USER}
@ -535,9 +532,8 @@ async def test_form_ssdp(hass: HomeAssistant) -> None:
}
async def test_form_ssdp_aborts_if_host_already_exists(
hass: HomeAssistant, config_entry: ConfigEntry
) -> None:
@pytest.mark.usefixtures("config_entry")
async def test_form_ssdp_aborts_if_host_already_exists(hass: HomeAssistant) -> None:
"""Test we abort if the host is already configured."""
result = await hass.config_entries.flow.async_init(
UNIFI_DOMAIN,
@ -557,9 +553,8 @@ async def test_form_ssdp_aborts_if_host_already_exists(
assert result["reason"] == "already_configured"
async def test_form_ssdp_aborts_if_serial_already_exists(
hass: HomeAssistant, config_entry: ConfigEntry
) -> None:
@pytest.mark.usefixtures("config_entry")
async def test_form_ssdp_aborts_if_serial_already_exists(hass: HomeAssistant) -> None:
"""Test we abort if the serial is already configured."""
result = await hass.config_entries.flow.async_init(

View file

@ -24,7 +24,6 @@ from homeassistant.setup import async_setup_component
from .conftest import DEFAULT_CONFIG_ENTRY_ID
from tests.common import flush_store
from tests.test_util.aiohttp import AiohttpClientMocker
from tests.typing import WebSocketGenerator
@ -35,7 +34,7 @@ async def test_setup_with_no_config(hass: HomeAssistant) -> None:
async def test_setup_entry_fails_config_entry_not_ready(
hass: HomeAssistant, config_entry_factory: Callable[[], ConfigEntry]
config_entry_factory: Callable[[], ConfigEntry],
) -> None:
"""Failed authentication trigger a reauthentication flow."""
with patch(
@ -170,8 +169,6 @@ async def test_wireless_clients(
)
async def test_remove_config_entry_device(
hass: HomeAssistant,
hass_storage: dict[str, Any],
aioclient_mock: AiohttpClientMocker,
device_registry: dr.DeviceRegistry,
config_entry_factory: Callable[[], ConfigEntry],
client_payload: list[dict[str, Any]],

View file

@ -289,7 +289,7 @@ async def test_services_handle_unloaded_config_entry(
aioclient_mock: AiohttpClientMocker,
device_registry: dr.DeviceRegistry,
config_entry_setup: ConfigEntry,
clients_all_payload,
clients_all_payload: dict[str, Any],
) -> None:
"""Verify no call is made if config entry is unloaded."""
await hass.config_entries.async_unload(config_entry_setup.entry_id)