mirror of
https://github.com/home-assistant/core.git
synced 2025-07-28 07:37:34 +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
|
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."""
|
"""Test config."""
|
||||||
invalid_configs = [None, 1, {}, {"name with space": None}]
|
|
||||||
|
|
||||||
for cfg in invalid_configs:
|
assert not await async_setup_component(hass, DOMAIN, {DOMAIN: invalid_config})
|
||||||
assert not await async_setup_component(hass, DOMAIN, {DOMAIN: cfg})
|
|
||||||
|
|
||||||
|
|
||||||
async def test_config_options(hass: HomeAssistant) -> None:
|
async def test_config_options(hass: HomeAssistant) -> None:
|
||||||
|
@ -54,12 +54,14 @@ def storage_setup(hass: HomeAssistant, hass_storage: dict[str, Any]):
|
|||||||
return _storage
|
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."""
|
"""Test config."""
|
||||||
invalid_configs = [None, 1, {}, {"name with space": None}]
|
|
||||||
|
|
||||||
for cfg in invalid_configs:
|
assert not await async_setup_component(hass, DOMAIN, {DOMAIN: invalid_config})
|
||||||
assert not await async_setup_component(hass, DOMAIN, {DOMAIN: cfg})
|
|
||||||
|
|
||||||
|
|
||||||
async def test_methods(hass: HomeAssistant) -> None:
|
async def test_methods(hass: HomeAssistant) -> None:
|
||||||
|
@ -47,12 +47,14 @@ def storage_setup(hass: HomeAssistant, hass_storage: dict[str, Any]):
|
|||||||
return _storage
|
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."""
|
"""Test config."""
|
||||||
invalid_configs = [None, 1, {}, {"name with space": None}]
|
|
||||||
|
|
||||||
for cfg in invalid_configs:
|
assert not await async_setup_component(hass, DOMAIN, {DOMAIN: invalid_config})
|
||||||
assert not await async_setup_component(hass, DOMAIN, {DOMAIN: cfg})
|
|
||||||
|
|
||||||
|
|
||||||
async def test_config_options(hass: HomeAssistant) -> None:
|
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:
|
@pytest.mark.parametrize(
|
||||||
"""Test config."""
|
"invalid_config",
|
||||||
invalid_configs = [
|
[
|
||||||
None,
|
None,
|
||||||
{},
|
|
||||||
{"name with space": None},
|
{"name with space": None},
|
||||||
{"test_1": {"min": 50, "max": 50}},
|
{"test_1": {"min": 50, "max": 50}},
|
||||||
]
|
{"test_1": {"min": 0, "max": 10, "initial": 11}},
|
||||||
for cfg in invalid_configs:
|
],
|
||||||
assert not await async_setup_component(hass, DOMAIN, {DOMAIN: cfg})
|
)
|
||||||
|
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:
|
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
|
return _storage
|
||||||
|
|
||||||
|
|
||||||
async def test_config(hass: HomeAssistant) -> None:
|
@pytest.mark.parametrize(
|
||||||
"""Test config."""
|
"invalid_config",
|
||||||
invalid_configs = [
|
[
|
||||||
None,
|
None,
|
||||||
{},
|
|
||||||
{"name with space": None},
|
{"name with space": None},
|
||||||
{"bad_initial": {"options": [1, 2], "initial": 3}},
|
{"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: invalid_config})
|
||||||
assert not await async_setup_component(hass, DOMAIN, {DOMAIN: cfg})
|
|
||||||
|
|
||||||
|
|
||||||
async def test_select_option(hass: HomeAssistant) -> None:
|
async def test_select_option(hass: HomeAssistant) -> None:
|
||||||
|
@ -131,16 +131,11 @@ def schedule_setup(
|
|||||||
return _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."""
|
"""Test invalid configs."""
|
||||||
invalid_configs = [
|
|
||||||
None,
|
|
||||||
{},
|
|
||||||
{"name with space": None},
|
|
||||||
]
|
|
||||||
|
|
||||||
for cfg in invalid_configs:
|
assert not await async_setup_component(hass, DOMAIN, {DOMAIN: invalid_config})
|
||||||
assert not await async_setup_component(hass, DOMAIN, {DOMAIN: cfg})
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
|
@ -92,12 +92,11 @@ def storage_setup(hass: HomeAssistant, hass_storage: dict[str, Any]):
|
|||||||
return _storage
|
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."""
|
"""Test config."""
|
||||||
invalid_configs = [None, 1, {}, {"name with space": None}]
|
|
||||||
|
|
||||||
for cfg in invalid_configs:
|
assert not await async_setup_component(hass, DOMAIN, {DOMAIN: invalid_config})
|
||||||
assert not await async_setup_component(hass, DOMAIN, {DOMAIN: cfg})
|
|
||||||
|
|
||||||
|
|
||||||
async def test_config_options(hass: HomeAssistant) -> None:
|
async def test_config_options(hass: HomeAssistant) -> None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user