mirror of
https://github.com/home-assistant/core.git
synced 2025-04-24 17:27:52 +00:00
Axis improve fixture naming (#120844)
This commit is contained in:
parent
d15d001cfc
commit
ca7fb906cc
@ -49,8 +49,8 @@ from .const import (
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def mock_setup_entry() -> Generator[AsyncMock]:
|
||||
@pytest.fixture(name="mock_setup_entry")
|
||||
def fixture_setup_entry() -> Generator[AsyncMock]:
|
||||
"""Override async_setup_entry."""
|
||||
with patch(
|
||||
"homeassistant.components.axis.async_setup_entry", return_value=True
|
||||
@ -62,7 +62,7 @@ def mock_setup_entry() -> Generator[AsyncMock]:
|
||||
|
||||
|
||||
@pytest.fixture(name="config_entry")
|
||||
def config_entry_fixture(
|
||||
def fixture_config_entry(
|
||||
hass: HomeAssistant,
|
||||
config_entry_data: MappingProxyType[str, Any],
|
||||
config_entry_options: MappingProxyType[str, Any],
|
||||
@ -82,13 +82,13 @@ def config_entry_fixture(
|
||||
|
||||
|
||||
@pytest.fixture(name="config_entry_version")
|
||||
def config_entry_version_fixture() -> int:
|
||||
def fixture_config_entry_version() -> int:
|
||||
"""Define a config entry version fixture."""
|
||||
return 3
|
||||
|
||||
|
||||
@pytest.fixture(name="config_entry_data")
|
||||
def config_entry_data_fixture() -> MappingProxyType[str, Any]:
|
||||
def fixture_config_entry_data() -> MappingProxyType[str, Any]:
|
||||
"""Define a config entry data fixture."""
|
||||
return {
|
||||
CONF_HOST: DEFAULT_HOST,
|
||||
@ -101,7 +101,7 @@ def config_entry_data_fixture() -> MappingProxyType[str, Any]:
|
||||
|
||||
|
||||
@pytest.fixture(name="config_entry_options")
|
||||
def config_entry_options_fixture() -> MappingProxyType[str, Any]:
|
||||
def fixture_config_entry_options() -> MappingProxyType[str, Any]:
|
||||
"""Define a config entry options fixture."""
|
||||
return {}
|
||||
|
||||
@ -109,8 +109,8 @@ def config_entry_options_fixture() -> MappingProxyType[str, Any]:
|
||||
# Axis API fixtures
|
||||
|
||||
|
||||
@pytest.fixture(name="mock_vapix_requests")
|
||||
def default_request_fixture(
|
||||
@pytest.fixture(name="mock_requests")
|
||||
def fixture_request(
|
||||
respx_mock: respx.MockRouter,
|
||||
port_management_payload: dict[str, Any],
|
||||
param_properties_payload: str,
|
||||
@ -215,7 +215,7 @@ def api_discovery_items() -> dict[str, Any]:
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def api_discovery_fixture(api_discovery_items: dict[str, Any]) -> None:
|
||||
def fixture_api_discovery(api_discovery_items: dict[str, Any]) -> None:
|
||||
"""Apidiscovery mock response."""
|
||||
data = deepcopy(API_DISCOVERY_RESPONSE)
|
||||
if api_discovery_items:
|
||||
@ -224,64 +224,65 @@ def api_discovery_fixture(api_discovery_items: dict[str, Any]) -> None:
|
||||
|
||||
|
||||
@pytest.fixture(name="port_management_payload")
|
||||
def io_port_management_data_fixture() -> dict[str, Any]:
|
||||
def fixture_io_port_management_data() -> dict[str, Any]:
|
||||
"""Property parameter data."""
|
||||
return PORT_MANAGEMENT_RESPONSE
|
||||
|
||||
|
||||
@pytest.fixture(name="param_properties_payload")
|
||||
def param_properties_data_fixture() -> str:
|
||||
def fixture_param_properties_data() -> str:
|
||||
"""Property parameter data."""
|
||||
return PROPERTIES_RESPONSE
|
||||
|
||||
|
||||
@pytest.fixture(name="param_ports_payload")
|
||||
def param_ports_data_fixture() -> str:
|
||||
def fixture_param_ports_data() -> str:
|
||||
"""Property parameter data."""
|
||||
return PORTS_RESPONSE
|
||||
|
||||
|
||||
@pytest.fixture(name="mqtt_status_code")
|
||||
def mqtt_status_code_fixture() -> int:
|
||||
def fixture_mqtt_status_code() -> int:
|
||||
"""Property parameter data."""
|
||||
return 200
|
||||
|
||||
|
||||
@pytest.fixture(name="setup_default_vapix_requests")
|
||||
def default_vapix_requests_fixture(mock_vapix_requests: Callable[[str], None]) -> None:
|
||||
@pytest.fixture(name="mock_default_requests")
|
||||
def fixture_default_requests(mock_requests: Callable[[str], None]) -> None:
|
||||
"""Mock default Vapix requests responses."""
|
||||
mock_vapix_requests(DEFAULT_HOST)
|
||||
mock_requests(DEFAULT_HOST)
|
||||
|
||||
|
||||
@pytest.fixture(name="prepare_config_entry")
|
||||
async def prep_config_entry_fixture(
|
||||
hass: HomeAssistant, config_entry: ConfigEntry, setup_default_vapix_requests: None
|
||||
@pytest.fixture(name="config_entry_factory")
|
||||
async def fixture_config_entry_factory(
|
||||
hass: HomeAssistant,
|
||||
config_entry: ConfigEntry,
|
||||
mock_requests: Callable[[str], None],
|
||||
) -> Callable[[], ConfigEntry]:
|
||||
"""Fixture factory to set up Axis network device."""
|
||||
|
||||
async def __mock_setup_config_entry() -> ConfigEntry:
|
||||
assert await hass.config_entries.async_setup(config_entry.entry_id)
|
||||
mock_requests(config_entry.data[CONF_HOST])
|
||||
await hass.config_entries.async_setup(config_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
return config_entry
|
||||
|
||||
return __mock_setup_config_entry
|
||||
|
||||
|
||||
@pytest.fixture(name="setup_config_entry")
|
||||
async def setup_config_entry_fixture(
|
||||
hass: HomeAssistant, config_entry: ConfigEntry, setup_default_vapix_requests: None
|
||||
@pytest.fixture(name="config_entry_setup")
|
||||
async def fixture_config_entry_setup(
|
||||
hass: HomeAssistant, config_entry_factory: Callable[[], ConfigEntry]
|
||||
) -> ConfigEntry:
|
||||
"""Define a fixture to set up Axis network device."""
|
||||
assert await hass.config_entries.async_setup(config_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
return config_entry
|
||||
return await config_entry_factory()
|
||||
|
||||
|
||||
# RTSP fixtures
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def mock_axis_rtspclient() -> Generator[Callable[[dict | None, str], None]]:
|
||||
@pytest.fixture(autouse=True, name="mock_axis_rtspclient")
|
||||
def fixture_axis_rtspclient() -> Generator[Callable[[dict | None, str], None]]:
|
||||
"""No real RTSP communication allowed."""
|
||||
with patch("axis.stream_manager.RTSPClient") as rtsp_client_mock:
|
||||
rtsp_client_mock.return_value.session.state = State.STOPPED
|
||||
@ -313,8 +314,8 @@ def mock_axis_rtspclient() -> Generator[Callable[[dict | None, str], None]]:
|
||||
yield make_rtsp_call
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def mock_rtsp_event(
|
||||
@pytest.fixture(autouse=True, name="mock_rtsp_event")
|
||||
def fixture_rtsp_event(
|
||||
mock_axis_rtspclient: Callable[[dict | None, str], None],
|
||||
) -> Callable[[str, str, str, str, str, str], None]:
|
||||
"""Fixture to allow mocking received RTSP events."""
|
||||
@ -366,8 +367,8 @@ def mock_rtsp_event(
|
||||
return send_event
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def mock_rtsp_signal_state(
|
||||
@pytest.fixture(autouse=True, name="mock_rtsp_signal_state")
|
||||
def fixture_rtsp_signal_state(
|
||||
mock_axis_rtspclient: Callable[[dict | None, str], None],
|
||||
) -> Callable[[bool], None]:
|
||||
"""Fixture to allow mocking RTSP state signalling."""
|
||||
|
@ -173,7 +173,7 @@ from .const import NAME
|
||||
),
|
||||
],
|
||||
)
|
||||
@pytest.mark.usefixtures("setup_config_entry")
|
||||
@pytest.mark.usefixtures("config_entry_setup")
|
||||
async def test_binary_sensors(
|
||||
hass: HomeAssistant,
|
||||
mock_rtsp_event: Callable[[str, str, str, str, str, str], None],
|
||||
@ -225,7 +225,7 @@ async def test_binary_sensors(
|
||||
},
|
||||
],
|
||||
)
|
||||
@pytest.mark.usefixtures("setup_config_entry")
|
||||
@pytest.mark.usefixtures("config_entry_setup")
|
||||
async def test_unsupported_events(
|
||||
hass: HomeAssistant,
|
||||
mock_rtsp_event: Callable[[str, str, str, str, str, str], None],
|
||||
|
@ -30,7 +30,7 @@ async def test_platform_manually_configured(hass: HomeAssistant) -> None:
|
||||
assert AXIS_DOMAIN not in hass.data
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("setup_config_entry")
|
||||
@pytest.mark.usefixtures("config_entry_setup")
|
||||
async def test_camera(hass: HomeAssistant) -> None:
|
||||
"""Test that Axis camera platform is loaded properly."""
|
||||
assert len(hass.states.async_entity_ids(CAMERA_DOMAIN)) == 1
|
||||
@ -51,7 +51,7 @@ async def test_camera(hass: HomeAssistant) -> None:
|
||||
|
||||
|
||||
@pytest.mark.parametrize("config_entry_options", [{CONF_STREAM_PROFILE: "profile_1"}])
|
||||
@pytest.mark.usefixtures("setup_config_entry")
|
||||
@pytest.mark.usefixtures("config_entry_setup")
|
||||
async def test_camera_with_stream_profile(hass: HomeAssistant) -> None:
|
||||
"""Test that Axis camera entity is using the correct path with stream profike."""
|
||||
assert len(hass.states.async_entity_ids(CAMERA_DOMAIN)) == 1
|
||||
@ -87,8 +87,8 @@ root.Properties.System.SerialNumber={MAC}
|
||||
|
||||
@pytest.mark.parametrize("param_properties_payload", [PROPERTY_DATA])
|
||||
async def test_camera_disabled(
|
||||
hass: HomeAssistant, prepare_config_entry: Callable[[], ConfigEntry]
|
||||
hass: HomeAssistant, config_entry_factory: Callable[[], ConfigEntry]
|
||||
) -> None:
|
||||
"""Test that Axis camera platform is loaded properly but does not create camera entity."""
|
||||
await prepare_config_entry()
|
||||
await config_entry_factory()
|
||||
assert len(hass.states.async_entity_ids(CAMERA_DOMAIN)) == 0
|
||||
|
@ -55,7 +55,7 @@ async def mock_config_entry_fixture(
|
||||
return config_entry
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("setup_default_vapix_requests", "mock_setup_entry")
|
||||
@pytest.mark.usefixtures("mock_default_requests", "mock_setup_entry")
|
||||
async def test_flow_manual_configuration(hass: HomeAssistant) -> None:
|
||||
"""Test that config flow works."""
|
||||
MockConfigEntry(domain=AXIS_DOMAIN, source=SOURCE_IGNORE).add_to_hass(hass)
|
||||
@ -94,7 +94,7 @@ async def test_flow_manual_configuration(hass: HomeAssistant) -> None:
|
||||
async def test_manual_configuration_update_configuration(
|
||||
hass: HomeAssistant,
|
||||
mock_config_entry: MockConfigEntry,
|
||||
mock_vapix_requests: Callable[[str], None],
|
||||
mock_requests: Callable[[str], None],
|
||||
) -> None:
|
||||
"""Test that config flow fails on already configured device."""
|
||||
assert mock_config_entry.data[CONF_HOST] == "1.2.3.4"
|
||||
@ -106,7 +106,7 @@ async def test_manual_configuration_update_configuration(
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
mock_vapix_requests("2.3.4.5")
|
||||
mock_requests("2.3.4.5")
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"],
|
||||
user_input={
|
||||
@ -178,7 +178,7 @@ async def test_flow_fails_cannot_connect(hass: HomeAssistant) -> None:
|
||||
assert result["errors"] == {"base": "cannot_connect"}
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("setup_default_vapix_requests", "mock_setup_entry")
|
||||
@pytest.mark.usefixtures("mock_default_requests", "mock_setup_entry")
|
||||
async def test_flow_create_entry_multiple_existing_entries_of_same_model(
|
||||
hass: HomeAssistant,
|
||||
) -> None:
|
||||
@ -230,7 +230,7 @@ async def test_flow_create_entry_multiple_existing_entries_of_same_model(
|
||||
async def test_reauth_flow_update_configuration(
|
||||
hass: HomeAssistant,
|
||||
mock_config_entry: MockConfigEntry,
|
||||
mock_vapix_requests: Callable[[str], None],
|
||||
mock_requests: Callable[[str], None],
|
||||
) -> None:
|
||||
"""Test that config flow fails on already configured device."""
|
||||
assert mock_config_entry.data[CONF_HOST] == "1.2.3.4"
|
||||
@ -246,7 +246,7 @@ async def test_reauth_flow_update_configuration(
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
mock_vapix_requests("2.3.4.5")
|
||||
mock_requests("2.3.4.5")
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"],
|
||||
user_input={
|
||||
@ -271,7 +271,7 @@ async def test_reauth_flow_update_configuration(
|
||||
async def test_reconfiguration_flow_update_configuration(
|
||||
hass: HomeAssistant,
|
||||
mock_config_entry: MockConfigEntry,
|
||||
mock_vapix_requests: Callable[[str], None],
|
||||
mock_requests: Callable[[str], None],
|
||||
) -> None:
|
||||
"""Test that config flow reconfiguration updates configured device."""
|
||||
assert mock_config_entry.data[CONF_HOST] == "1.2.3.4"
|
||||
@ -289,7 +289,7 @@ async def test_reconfiguration_flow_update_configuration(
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
mock_vapix_requests("2.3.4.5")
|
||||
mock_requests("2.3.4.5")
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"],
|
||||
user_input={
|
||||
@ -372,7 +372,7 @@ async def test_reconfiguration_flow_update_configuration(
|
||||
),
|
||||
],
|
||||
)
|
||||
@pytest.mark.usefixtures("setup_default_vapix_requests", "mock_setup_entry")
|
||||
@pytest.mark.usefixtures("mock_default_requests", "mock_setup_entry")
|
||||
async def test_discovery_flow(
|
||||
hass: HomeAssistant,
|
||||
source: str,
|
||||
@ -514,7 +514,7 @@ async def test_discovered_device_already_configured(
|
||||
async def test_discovery_flow_updated_configuration(
|
||||
hass: HomeAssistant,
|
||||
mock_config_entry: MockConfigEntry,
|
||||
mock_vapix_requests: Callable[[str], None],
|
||||
mock_requests: Callable[[str], None],
|
||||
source: str,
|
||||
discovery_info: BaseServiceInfo,
|
||||
expected_port: int,
|
||||
@ -529,7 +529,7 @@ async def test_discovery_flow_updated_configuration(
|
||||
CONF_NAME: NAME,
|
||||
}
|
||||
|
||||
mock_vapix_requests("2.3.4.5")
|
||||
mock_requests("2.3.4.5")
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
AXIS_DOMAIN, data=discovery_info, context={"source": source}
|
||||
)
|
||||
@ -646,13 +646,13 @@ async def test_discovery_flow_ignore_link_local_address(
|
||||
|
||||
|
||||
async def test_option_flow(
|
||||
hass: HomeAssistant, setup_config_entry: ConfigEntry
|
||||
hass: HomeAssistant, config_entry_setup: ConfigEntry
|
||||
) -> None:
|
||||
"""Test config flow options."""
|
||||
assert CONF_STREAM_PROFILE not in setup_config_entry.options
|
||||
assert CONF_VIDEO_SOURCE not in setup_config_entry.options
|
||||
assert CONF_STREAM_PROFILE not in config_entry_setup.options
|
||||
assert CONF_VIDEO_SOURCE not in config_entry_setup.options
|
||||
|
||||
result = await hass.config_entries.options.async_init(setup_config_entry.entry_id)
|
||||
result = await hass.config_entries.options.async_init(config_entry_setup.entry_id)
|
||||
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "configure_stream"
|
||||
@ -676,5 +676,5 @@ async def test_option_flow(
|
||||
CONF_STREAM_PROFILE: "profile_1",
|
||||
CONF_VIDEO_SOURCE: 1,
|
||||
}
|
||||
assert setup_config_entry.options[CONF_STREAM_PROFILE] == "profile_1"
|
||||
assert setup_config_entry.options[CONF_VIDEO_SOURCE] == 1
|
||||
assert config_entry_setup.options[CONF_STREAM_PROFILE] == "profile_1"
|
||||
assert config_entry_setup.options[CONF_VIDEO_SOURCE] == 1
|
||||
|
@ -16,11 +16,11 @@ from tests.typing import ClientSessionGenerator
|
||||
async def test_entry_diagnostics(
|
||||
hass: HomeAssistant,
|
||||
hass_client: ClientSessionGenerator,
|
||||
setup_config_entry: ConfigEntry,
|
||||
config_entry_setup: ConfigEntry,
|
||||
snapshot: SnapshotAssertion,
|
||||
) -> None:
|
||||
"""Test config entry diagnostics."""
|
||||
assert (
|
||||
await get_diagnostics_for_config_entry(hass, hass_client, setup_config_entry)
|
||||
await get_diagnostics_for_config_entry(hass, hass_client, config_entry_setup)
|
||||
== snapshot
|
||||
)
|
||||
|
@ -50,11 +50,11 @@ def hass_mock_forward_entry_setup(hass: HomeAssistant) -> Generator[AsyncMock]:
|
||||
async def test_device_setup(
|
||||
forward_entry_setups: AsyncMock,
|
||||
config_entry_data: MappingProxyType[str, Any],
|
||||
setup_config_entry: ConfigEntry,
|
||||
config_entry_setup: ConfigEntry,
|
||||
device_registry: dr.DeviceRegistry,
|
||||
) -> None:
|
||||
"""Successful setup."""
|
||||
hub = setup_config_entry.runtime_data
|
||||
hub = config_entry_setup.runtime_data
|
||||
|
||||
assert hub.api.vapix.firmware_version == "9.10.1"
|
||||
assert hub.api.vapix.product_number == "M1065-LW"
|
||||
@ -78,9 +78,9 @@ async def test_device_setup(
|
||||
|
||||
|
||||
@pytest.mark.parametrize("api_discovery_items", [API_DISCOVERY_BASIC_DEVICE_INFO])
|
||||
async def test_device_info(setup_config_entry: ConfigEntry) -> None:
|
||||
async def test_device_info(config_entry_setup: ConfigEntry) -> None:
|
||||
"""Verify other path of device information works."""
|
||||
hub = setup_config_entry.runtime_data
|
||||
hub = config_entry_setup.runtime_data
|
||||
|
||||
assert hub.api.vapix.firmware_version == "9.80.1"
|
||||
assert hub.api.vapix.product_number == "M1065-LW"
|
||||
@ -89,7 +89,7 @@ async def test_device_info(setup_config_entry: ConfigEntry) -> None:
|
||||
|
||||
|
||||
@pytest.mark.parametrize("api_discovery_items", [API_DISCOVERY_MQTT])
|
||||
@pytest.mark.usefixtures("setup_config_entry")
|
||||
@pytest.mark.usefixtures("config_entry_setup")
|
||||
async def test_device_support_mqtt(
|
||||
hass: HomeAssistant, mqtt_mock: MqttMockHAClient
|
||||
) -> None:
|
||||
@ -115,7 +115,7 @@ async def test_device_support_mqtt(
|
||||
|
||||
@pytest.mark.parametrize("api_discovery_items", [API_DISCOVERY_MQTT])
|
||||
@pytest.mark.parametrize("mqtt_status_code", [401])
|
||||
@pytest.mark.usefixtures("setup_config_entry")
|
||||
@pytest.mark.usefixtures("config_entry_setup")
|
||||
async def test_device_support_mqtt_low_privilege(mqtt_mock: MqttMockHAClient) -> None:
|
||||
"""Successful setup."""
|
||||
mqtt_call = call(f"{MAC}/#", mock.ANY, 0, "utf-8")
|
||||
@ -124,14 +124,14 @@ async def test_device_support_mqtt_low_privilege(mqtt_mock: MqttMockHAClient) ->
|
||||
|
||||
async def test_update_address(
|
||||
hass: HomeAssistant,
|
||||
setup_config_entry: ConfigEntry,
|
||||
mock_vapix_requests: Callable[[str], None],
|
||||
config_entry_setup: ConfigEntry,
|
||||
mock_requests: Callable[[str], None],
|
||||
) -> None:
|
||||
"""Test update address works."""
|
||||
hub = setup_config_entry.runtime_data
|
||||
hub = config_entry_setup.runtime_data
|
||||
assert hub.api.config.host == "1.2.3.4"
|
||||
|
||||
mock_vapix_requests("2.3.4.5")
|
||||
mock_requests("2.3.4.5")
|
||||
await hass.config_entries.flow.async_init(
|
||||
AXIS_DOMAIN,
|
||||
data=zeroconf.ZeroconfServiceInfo(
|
||||
@ -150,7 +150,7 @@ async def test_update_address(
|
||||
assert hub.api.config.host == "2.3.4.5"
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("setup_config_entry")
|
||||
@pytest.mark.usefixtures("config_entry_setup")
|
||||
async def test_device_unavailable(
|
||||
hass: HomeAssistant,
|
||||
mock_rtsp_event: Callable[[str, str, str, str, str, str], None],
|
||||
@ -187,7 +187,7 @@ async def test_device_unavailable(
|
||||
assert hass.states.get(f"{BINARY_SENSOR_DOMAIN}.{NAME}_sound_1").state == STATE_OFF
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("setup_default_vapix_requests")
|
||||
@pytest.mark.usefixtures("mock_default_requests")
|
||||
async def test_device_not_accessible(
|
||||
hass: HomeAssistant, config_entry: ConfigEntry
|
||||
) -> None:
|
||||
@ -198,7 +198,7 @@ async def test_device_not_accessible(
|
||||
assert hass.data[AXIS_DOMAIN] == {}
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("setup_default_vapix_requests")
|
||||
@pytest.mark.usefixtures("mock_default_requests")
|
||||
async def test_device_trigger_reauth_flow(
|
||||
hass: HomeAssistant, config_entry: ConfigEntry
|
||||
) -> None:
|
||||
@ -215,7 +215,7 @@ async def test_device_trigger_reauth_flow(
|
||||
assert hass.data[AXIS_DOMAIN] == {}
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("setup_default_vapix_requests")
|
||||
@pytest.mark.usefixtures("mock_default_requests")
|
||||
async def test_device_unknown_error(
|
||||
hass: HomeAssistant, config_entry: ConfigEntry
|
||||
) -> None:
|
||||
|
@ -9,9 +9,9 @@ from homeassistant.config_entries import ConfigEntry, ConfigEntryState
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
|
||||
async def test_setup_entry(setup_config_entry: ConfigEntry) -> None:
|
||||
async def test_setup_entry(config_entry_setup: ConfigEntry) -> None:
|
||||
"""Test successful setup of entry."""
|
||||
assert setup_config_entry.state is ConfigEntryState.LOADED
|
||||
assert config_entry_setup.state is ConfigEntryState.LOADED
|
||||
|
||||
|
||||
async def test_setup_entry_fails(
|
||||
@ -30,13 +30,13 @@ async def test_setup_entry_fails(
|
||||
|
||||
|
||||
async def test_unload_entry(
|
||||
hass: HomeAssistant, setup_config_entry: ConfigEntry
|
||||
hass: HomeAssistant, config_entry_setup: ConfigEntry
|
||||
) -> None:
|
||||
"""Test successful unload of entry."""
|
||||
assert setup_config_entry.state is ConfigEntryState.LOADED
|
||||
assert config_entry_setup.state is ConfigEntryState.LOADED
|
||||
|
||||
assert await hass.config_entries.async_unload(setup_config_entry.entry_id)
|
||||
assert setup_config_entry.state is ConfigEntryState.NOT_LOADED
|
||||
assert await hass.config_entries.async_unload(config_entry_setup.entry_id)
|
||||
assert config_entry_setup.state is ConfigEntryState.NOT_LOADED
|
||||
|
||||
|
||||
@pytest.mark.parametrize("config_entry_version", [1])
|
||||
|
@ -69,7 +69,7 @@ def light_control_fixture(light_control_items: list[dict[str, Any]]) -> None:
|
||||
|
||||
@pytest.mark.parametrize("api_discovery_items", [API_DISCOVERY_LIGHT_CONTROL])
|
||||
@pytest.mark.parametrize("light_control_items", [[]])
|
||||
@pytest.mark.usefixtures("setup_config_entry")
|
||||
@pytest.mark.usefixtures("config_entry_setup")
|
||||
async def test_no_light_entity_without_light_control_representation(
|
||||
hass: HomeAssistant,
|
||||
mock_rtsp_event: Callable[[str, str, str, str, str, str], None],
|
||||
@ -88,7 +88,7 @@ async def test_no_light_entity_without_light_control_representation(
|
||||
|
||||
|
||||
@pytest.mark.parametrize("api_discovery_items", [API_DISCOVERY_LIGHT_CONTROL])
|
||||
@pytest.mark.usefixtures("setup_config_entry")
|
||||
@pytest.mark.usefixtures("config_entry_setup")
|
||||
async def test_lights(
|
||||
hass: HomeAssistant,
|
||||
mock_rtsp_event: Callable[[str, str, str, str, str, str], None],
|
||||
|
@ -30,7 +30,7 @@ root.IOPort.I1.Output.Active=open
|
||||
|
||||
|
||||
@pytest.mark.parametrize("param_ports_payload", [PORT_DATA])
|
||||
@pytest.mark.usefixtures("setup_config_entry")
|
||||
@pytest.mark.usefixtures("config_entry_setup")
|
||||
async def test_switches_with_port_cgi(
|
||||
hass: HomeAssistant,
|
||||
mock_rtsp_event: Callable[[str, str, str, str, str, str], None],
|
||||
@ -115,7 +115,7 @@ PORT_MANAGEMENT_RESPONSE = {
|
||||
|
||||
@pytest.mark.parametrize("api_discovery_items", [API_DISCOVERY_PORT_MANAGEMENT])
|
||||
@pytest.mark.parametrize("port_management_payload", [PORT_MANAGEMENT_RESPONSE])
|
||||
@pytest.mark.usefixtures("setup_config_entry")
|
||||
@pytest.mark.usefixtures("config_entry_setup")
|
||||
async def test_switches_with_port_management(
|
||||
hass: HomeAssistant,
|
||||
mock_rtsp_event: Callable[[str, str, str, str, str, str], None],
|
||||
|
Loading…
x
Reference in New Issue
Block a user