mirror of
https://github.com/home-assistant/core.git
synced 2025-07-27 23:27:37 +00:00
Fix broken invalid_config tests (#148965)
This commit is contained in:
parent
414057d455
commit
57c024449c
@ -73,12 +73,14 @@ def storage_setup(hass: HomeAssistant, hass_storage: dict[str, Any]):
|
||||
return _storage
|
||||
|
||||
|
||||
async def test_config(hass: HomeAssistant) -> None:
|
||||
@pytest.mark.parametrize(
|
||||
"invalid_config",
|
||||
[None, 1, {"name with space": None}],
|
||||
)
|
||||
async def test_config(hass: HomeAssistant, invalid_config) -> None:
|
||||
"""Test config."""
|
||||
invalid_configs = [None, 1, {}, {"name with space": None}]
|
||||
|
||||
for cfg in invalid_configs:
|
||||
assert not await async_setup_component(hass, DOMAIN, {DOMAIN: cfg})
|
||||
assert not await async_setup_component(hass, DOMAIN, {DOMAIN: invalid_config})
|
||||
|
||||
|
||||
async def test_config_options(hass: HomeAssistant) -> None:
|
||||
|
@ -54,12 +54,14 @@ def storage_setup(hass: HomeAssistant, hass_storage: dict[str, Any]):
|
||||
return _storage
|
||||
|
||||
|
||||
async def test_config(hass: HomeAssistant) -> None:
|
||||
@pytest.mark.parametrize(
|
||||
"invalid_config",
|
||||
[None, 1, {"name with space": None}],
|
||||
)
|
||||
async def test_config(hass: HomeAssistant, invalid_config) -> None:
|
||||
"""Test config."""
|
||||
invalid_configs = [None, 1, {}, {"name with space": None}]
|
||||
|
||||
for cfg in invalid_configs:
|
||||
assert not await async_setup_component(hass, DOMAIN, {DOMAIN: cfg})
|
||||
assert not await async_setup_component(hass, DOMAIN, {DOMAIN: invalid_config})
|
||||
|
||||
|
||||
async def test_methods(hass: HomeAssistant) -> None:
|
||||
|
@ -47,12 +47,14 @@ def storage_setup(hass: HomeAssistant, hass_storage: dict[str, Any]):
|
||||
return _storage
|
||||
|
||||
|
||||
async def test_config(hass: HomeAssistant) -> None:
|
||||
@pytest.mark.parametrize(
|
||||
"invalid_config",
|
||||
[None, 1, {"name with space": None}],
|
||||
)
|
||||
async def test_config(hass: HomeAssistant, invalid_config) -> None:
|
||||
"""Test config."""
|
||||
invalid_configs = [None, 1, {}, {"name with space": None}]
|
||||
|
||||
for cfg in invalid_configs:
|
||||
assert not await async_setup_component(hass, DOMAIN, {DOMAIN: cfg})
|
||||
assert not await async_setup_component(hass, DOMAIN, {DOMAIN: invalid_config})
|
||||
|
||||
|
||||
async def test_config_options(hass: HomeAssistant) -> None:
|
||||
|
@ -98,16 +98,19 @@ async def decrement(hass: HomeAssistant, entity_id: str) -> None:
|
||||
)
|
||||
|
||||
|
||||
async def test_config(hass: HomeAssistant) -> None:
|
||||
"""Test config."""
|
||||
invalid_configs = [
|
||||
@pytest.mark.parametrize(
|
||||
"invalid_config",
|
||||
[
|
||||
None,
|
||||
{},
|
||||
{"name with space": None},
|
||||
{"test_1": {"min": 50, "max": 50}},
|
||||
]
|
||||
for cfg in invalid_configs:
|
||||
assert not await async_setup_component(hass, DOMAIN, {DOMAIN: cfg})
|
||||
{"test_1": {"min": 0, "max": 10, "initial": 11}},
|
||||
],
|
||||
)
|
||||
async def test_config(hass: HomeAssistant, invalid_config) -> None:
|
||||
"""Test config."""
|
||||
|
||||
assert not await async_setup_component(hass, DOMAIN, {DOMAIN: invalid_config})
|
||||
|
||||
|
||||
async def test_set_value(hass: HomeAssistant, caplog: pytest.LogCaptureFixture) -> None:
|
||||
|
@ -70,17 +70,18 @@ def storage_setup(hass: HomeAssistant, hass_storage: dict[str, Any]):
|
||||
return _storage
|
||||
|
||||
|
||||
async def test_config(hass: HomeAssistant) -> None:
|
||||
"""Test config."""
|
||||
invalid_configs = [
|
||||
@pytest.mark.parametrize(
|
||||
"invalid_config",
|
||||
[
|
||||
None,
|
||||
{},
|
||||
{"name with space": None},
|
||||
{"bad_initial": {"options": [1, 2], "initial": 3}},
|
||||
]
|
||||
],
|
||||
)
|
||||
async def test_config(hass: HomeAssistant, invalid_config) -> None:
|
||||
"""Test config."""
|
||||
|
||||
for cfg in invalid_configs:
|
||||
assert not await async_setup_component(hass, DOMAIN, {DOMAIN: cfg})
|
||||
assert not await async_setup_component(hass, DOMAIN, {DOMAIN: invalid_config})
|
||||
|
||||
|
||||
async def test_select_option(hass: HomeAssistant) -> None:
|
||||
|
@ -131,16 +131,11 @@ def schedule_setup(
|
||||
return _schedule_setup
|
||||
|
||||
|
||||
async def test_invalid_config(hass: HomeAssistant) -> None:
|
||||
@pytest.mark.parametrize("invalid_config", [None, {"name with space": None}])
|
||||
async def test_invalid_config(hass: HomeAssistant, invalid_config) -> None:
|
||||
"""Test invalid configs."""
|
||||
invalid_configs = [
|
||||
None,
|
||||
{},
|
||||
{"name with space": None},
|
||||
]
|
||||
|
||||
for cfg in invalid_configs:
|
||||
assert not await async_setup_component(hass, DOMAIN, {DOMAIN: cfg})
|
||||
assert not await async_setup_component(hass, DOMAIN, {DOMAIN: invalid_config})
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
|
@ -92,12 +92,11 @@ def storage_setup(hass: HomeAssistant, hass_storage: dict[str, Any]):
|
||||
return _storage
|
||||
|
||||
|
||||
async def test_config(hass: HomeAssistant) -> None:
|
||||
@pytest.mark.parametrize("invalid_config", [None, 1, {"name with space": None}])
|
||||
async def test_config(hass: HomeAssistant, invalid_config) -> None:
|
||||
"""Test config."""
|
||||
invalid_configs = [None, 1, {}, {"name with space": None}]
|
||||
|
||||
for cfg in invalid_configs:
|
||||
assert not await async_setup_component(hass, DOMAIN, {DOMAIN: cfg})
|
||||
assert not await async_setup_component(hass, DOMAIN, {DOMAIN: invalid_config})
|
||||
|
||||
|
||||
async def test_config_options(hass: HomeAssistant) -> None:
|
||||
|
Loading…
x
Reference in New Issue
Block a user