mirror of
https://github.com/home-assistant/core.git
synced 2025-04-26 10:17:51 +00:00
Default hass_config
to contain an empty config (#88515)
* Default hass_config to {} * Correct type hint
This commit is contained in:
parent
60ca3b3223
commit
ebb450c946
@ -109,7 +109,7 @@ _TEST_FIXTURES: dict[str, list[str] | str] = {
|
|||||||
"hass_admin_user": "MockUser",
|
"hass_admin_user": "MockUser",
|
||||||
"hass_client": "ClientSessionGenerator",
|
"hass_client": "ClientSessionGenerator",
|
||||||
"hass_client_no_auth": "ClientSessionGenerator",
|
"hass_client_no_auth": "ClientSessionGenerator",
|
||||||
"hass_config": "ConfigType | None",
|
"hass_config": "ConfigType",
|
||||||
"hass_config_yaml": "str | None",
|
"hass_config_yaml": "str | None",
|
||||||
"hass_config_yaml_files": "dict[str, str] | None",
|
"hass_config_yaml_files": "dict[str, str] | None",
|
||||||
"hass_owner_user": "MockUser",
|
"hass_owner_user": "MockUser",
|
||||||
|
@ -27,7 +27,7 @@ from tests.common import async_mock_service
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
async def test_if_fires_on_hass_start(
|
async def test_if_fires_on_hass_start(
|
||||||
hass: HomeAssistant, mock_hass_config: None, hass_config: ConfigType | None
|
hass: HomeAssistant, mock_hass_config: None, hass_config: ConfigType
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test the firing when Home Assistant starts."""
|
"""Test the firing when Home Assistant starts."""
|
||||||
calls = async_mock_service(hass, "test", "automation")
|
calls = async_mock_service(hass, "test", "automation")
|
||||||
|
@ -920,19 +920,19 @@ async def _mqtt_mock_entry(
|
|||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def hass_config() -> ConfigType | None:
|
def hass_config() -> ConfigType:
|
||||||
"""Fixture to parametrize the content of main configuration using mock_hass_config.
|
"""Fixture to parametrize the content of main configuration using mock_hass_config.
|
||||||
|
|
||||||
To set a configuration, tests can be marked with:
|
To set a configuration, tests can be marked with:
|
||||||
@pytest.mark.parametrize("hass_config", [{integration: {...}}])
|
@pytest.mark.parametrize("hass_config", [{integration: {...}}])
|
||||||
Add the `mock_hass_config: None` fixture to the test.
|
Add the `mock_hass_config: None` fixture to the test.
|
||||||
"""
|
"""
|
||||||
return None
|
return {}
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def mock_hass_config(
|
def mock_hass_config(
|
||||||
hass: HomeAssistant, hass_config: ConfigType | None
|
hass: HomeAssistant, hass_config: ConfigType
|
||||||
) -> Generator[None, None, None]:
|
) -> Generator[None, None, None]:
|
||||||
"""Fixture to mock the content of main configuration.
|
"""Fixture to mock the content of main configuration.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user