mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
Move mock_hass_config fixture to decorator (#118807)
This commit is contained in:
parent
2ac5f8db06
commit
089874f818
@ -266,11 +266,11 @@ async def test_send_usage(
|
||||
assert snapshot == submitted_data
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("mock_hass_config")
|
||||
async def test_send_usage_with_supervisor(
|
||||
hass: HomeAssistant,
|
||||
caplog: pytest.LogCaptureFixture,
|
||||
aioclient_mock: AiohttpClientMocker,
|
||||
mock_hass_config: None,
|
||||
snapshot: SnapshotAssertion,
|
||||
) -> None:
|
||||
"""Test send usage with supervisor preferences are defined."""
|
||||
@ -359,11 +359,9 @@ async def test_send_statistics(
|
||||
assert snapshot == submitted_data
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("mock_hass_config")
|
||||
async def test_send_statistics_one_integration_fails(
|
||||
hass: HomeAssistant,
|
||||
caplog: pytest.LogCaptureFixture,
|
||||
aioclient_mock: AiohttpClientMocker,
|
||||
mock_hass_config: None,
|
||||
hass: HomeAssistant, aioclient_mock: AiohttpClientMocker
|
||||
) -> None:
|
||||
"""Test send statistics preferences are defined."""
|
||||
aioclient_mock.post(ANALYTICS_ENDPOINT_URL, status=200)
|
||||
@ -384,11 +382,11 @@ async def test_send_statistics_one_integration_fails(
|
||||
assert post_call[2]["integration_count"] == 0
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("mock_hass_config")
|
||||
async def test_send_statistics_disabled_integration(
|
||||
hass: HomeAssistant,
|
||||
caplog: pytest.LogCaptureFixture,
|
||||
aioclient_mock: AiohttpClientMocker,
|
||||
mock_hass_config: None,
|
||||
installation_type_mock: Generator[Any, Any, None],
|
||||
snapshot: SnapshotAssertion,
|
||||
) -> None:
|
||||
@ -422,11 +420,11 @@ async def test_send_statistics_disabled_integration(
|
||||
assert snapshot == submitted_data
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("mock_hass_config")
|
||||
async def test_send_statistics_ignored_integration(
|
||||
hass: HomeAssistant,
|
||||
caplog: pytest.LogCaptureFixture,
|
||||
aioclient_mock: AiohttpClientMocker,
|
||||
mock_hass_config: None,
|
||||
installation_type_mock: Generator[Any, Any, None],
|
||||
snapshot: SnapshotAssertion,
|
||||
) -> None:
|
||||
@ -466,11 +464,9 @@ async def test_send_statistics_ignored_integration(
|
||||
assert snapshot == submitted_data
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("mock_hass_config")
|
||||
async def test_send_statistics_async_get_integration_unknown_exception(
|
||||
hass: HomeAssistant,
|
||||
caplog: pytest.LogCaptureFixture,
|
||||
aioclient_mock: AiohttpClientMocker,
|
||||
mock_hass_config: None,
|
||||
hass: HomeAssistant, aioclient_mock: AiohttpClientMocker
|
||||
) -> None:
|
||||
"""Test send statistics preferences are defined."""
|
||||
aioclient_mock.post(ANALYTICS_ENDPOINT_URL, status=200)
|
||||
@ -490,11 +486,11 @@ async def test_send_statistics_async_get_integration_unknown_exception(
|
||||
await analytics.send_analytics()
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("mock_hass_config")
|
||||
async def test_send_statistics_with_supervisor(
|
||||
hass: HomeAssistant,
|
||||
caplog: pytest.LogCaptureFixture,
|
||||
aioclient_mock: AiohttpClientMocker,
|
||||
mock_hass_config: None,
|
||||
snapshot: SnapshotAssertion,
|
||||
) -> None:
|
||||
"""Test send statistics preferences are defined."""
|
||||
@ -655,10 +651,10 @@ async def test_nightly_endpoint(
|
||||
assert str(payload[1]) == ANALYTICS_ENDPOINT_URL
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("mock_hass_config")
|
||||
async def test_send_with_no_energy(
|
||||
hass: HomeAssistant,
|
||||
aioclient_mock: AiohttpClientMocker,
|
||||
mock_hass_config: None,
|
||||
caplog: pytest.LogCaptureFixture,
|
||||
installation_type_mock: Generator[Any, Any, None],
|
||||
snapshot: SnapshotAssertion,
|
||||
@ -692,11 +688,10 @@ async def test_send_with_no_energy(
|
||||
assert snapshot == submitted_data
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("recorder_mock", "mock_hass_config")
|
||||
async def test_send_with_no_energy_config(
|
||||
recorder_mock: Recorder,
|
||||
hass: HomeAssistant,
|
||||
aioclient_mock: AiohttpClientMocker,
|
||||
mock_hass_config: None,
|
||||
caplog: pytest.LogCaptureFixture,
|
||||
installation_type_mock: Generator[Any, Any, None],
|
||||
snapshot: SnapshotAssertion,
|
||||
@ -725,11 +720,10 @@ async def test_send_with_no_energy_config(
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("recorder_mock", "mock_hass_config")
|
||||
async def test_send_with_energy_config(
|
||||
recorder_mock: Recorder,
|
||||
hass: HomeAssistant,
|
||||
aioclient_mock: AiohttpClientMocker,
|
||||
mock_hass_config: None,
|
||||
caplog: pytest.LogCaptureFixture,
|
||||
installation_type_mock: Generator[Any, Any, None],
|
||||
snapshot: SnapshotAssertion,
|
||||
@ -758,11 +752,11 @@ async def test_send_with_energy_config(
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("mock_hass_config")
|
||||
async def test_send_usage_with_certificate(
|
||||
hass: HomeAssistant,
|
||||
caplog: pytest.LogCaptureFixture,
|
||||
aioclient_mock: AiohttpClientMocker,
|
||||
mock_hass_config: None,
|
||||
installation_type_mock: Generator[Any, Any, None],
|
||||
snapshot: SnapshotAssertion,
|
||||
) -> None:
|
||||
@ -836,11 +830,11 @@ async def test_send_with_problems_loading_yaml(
|
||||
assert len(aioclient_mock.mock_calls) == 0
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("mock_hass_config")
|
||||
async def test_timeout_while_sending(
|
||||
hass: HomeAssistant,
|
||||
caplog: pytest.LogCaptureFixture,
|
||||
aioclient_mock: AiohttpClientMocker,
|
||||
mock_hass_config: None,
|
||||
) -> None:
|
||||
"""Test timeout error while sending analytics."""
|
||||
analytics = Analytics(hass)
|
||||
|
@ -27,8 +27,9 @@ from tests.common import async_mock_service
|
||||
}
|
||||
],
|
||||
)
|
||||
@pytest.mark.usefixtures("mock_hass_config")
|
||||
async def test_if_fires_on_hass_start(
|
||||
hass: HomeAssistant, mock_hass_config: None, hass_config: ConfigType
|
||||
hass: HomeAssistant, hass_config: ConfigType
|
||||
) -> None:
|
||||
"""Test the firing when Home Assistant starts."""
|
||||
calls = async_mock_service(hass, "test", "automation")
|
||||
|
@ -31,12 +31,12 @@ from tests.typing import ClientSessionGenerator
|
||||
|
||||
|
||||
@pytest.mark.parametrize("hass_config", [{}])
|
||||
@pytest.mark.usefixtures("mock_hass_config")
|
||||
async def test_diagnostics(
|
||||
hass: HomeAssistant,
|
||||
hass_client: ClientSessionGenerator,
|
||||
mock_config_entry: MockConfigEntry,
|
||||
knx: KNXTestKit,
|
||||
mock_hass_config: None,
|
||||
snapshot: SnapshotAssertion,
|
||||
) -> None:
|
||||
"""Test diagnostics."""
|
||||
@ -51,9 +51,9 @@ async def test_diagnostics(
|
||||
|
||||
|
||||
@pytest.mark.parametrize("hass_config", [{"knx": {"wrong_key": {}}}])
|
||||
@pytest.mark.usefixtures("mock_hass_config")
|
||||
async def test_diagnostic_config_error(
|
||||
hass: HomeAssistant,
|
||||
mock_hass_config: None,
|
||||
hass_client: ClientSessionGenerator,
|
||||
mock_config_entry: MockConfigEntry,
|
||||
knx: KNXTestKit,
|
||||
@ -72,10 +72,10 @@ async def test_diagnostic_config_error(
|
||||
|
||||
|
||||
@pytest.mark.parametrize("hass_config", [{}])
|
||||
@pytest.mark.usefixtures("mock_hass_config")
|
||||
async def test_diagnostic_redact(
|
||||
hass: HomeAssistant,
|
||||
hass_client: ClientSessionGenerator,
|
||||
mock_hass_config: None,
|
||||
snapshot: SnapshotAssertion,
|
||||
) -> None:
|
||||
"""Test diagnostics redacting data."""
|
||||
@ -107,12 +107,12 @@ async def test_diagnostic_redact(
|
||||
|
||||
|
||||
@pytest.mark.parametrize("hass_config", [{}])
|
||||
@pytest.mark.usefixtures("mock_hass_config")
|
||||
async def test_diagnostics_project(
|
||||
hass: HomeAssistant,
|
||||
hass_client: ClientSessionGenerator,
|
||||
mock_config_entry: MockConfigEntry,
|
||||
knx: KNXTestKit,
|
||||
mock_hass_config: None,
|
||||
load_knxproj: None,
|
||||
snapshot: SnapshotAssertion,
|
||||
) -> None:
|
||||
|
@ -928,9 +928,9 @@ def test_entity_device_info_schema() -> None:
|
||||
}
|
||||
],
|
||||
)
|
||||
@pytest.mark.usefixtures("mock_hass_config")
|
||||
async def test_handle_logging_on_writing_the_entity_state(
|
||||
hass: HomeAssistant,
|
||||
mock_hass_config: None,
|
||||
mqtt_mock_entry: MqttMockHAClientGenerator,
|
||||
caplog: pytest.LogCaptureFixture,
|
||||
) -> None:
|
||||
|
Loading…
x
Reference in New Issue
Block a user