mirror of
https://github.com/home-assistant/core.git
synced 2025-08-20 21:12:13 +02:00
simplify user check
This commit is contained in:
@@ -53,9 +53,16 @@ def remote_fixture():
|
|||||||
async def test_user(hass, remote):
|
async def test_user(hass, remote):
|
||||||
"""Test starting a flow by user."""
|
"""Test starting a flow by user."""
|
||||||
|
|
||||||
# entry was added
|
# show form
|
||||||
result = await hass.config_entries.flow.async_init(
|
result = await hass.config_entries.flow.async_init(
|
||||||
DOMAIN, context={"source": "user"}, data=MOCK_USER_DATA
|
DOMAIN, context={"source": "user"}
|
||||||
|
)
|
||||||
|
assert result["type"] == "form"
|
||||||
|
assert result["step_id"] == "user"
|
||||||
|
|
||||||
|
# entry was added
|
||||||
|
result = await hass.config_entries.flow.async_configure(
|
||||||
|
result["flow_id"], user_input=MOCK_USER_DATA
|
||||||
)
|
)
|
||||||
assert result["type"] == "create_entry"
|
assert result["type"] == "create_entry"
|
||||||
assert result["title"] == "fake_name"
|
assert result["title"] == "fake_name"
|
||||||
@@ -66,18 +73,6 @@ async def test_user(hass, remote):
|
|||||||
assert result["data"][CONF_ID] is None
|
assert result["data"][CONF_ID] is None
|
||||||
|
|
||||||
|
|
||||||
async def test_user_empty(hass, remote):
|
|
||||||
"""Test starting a flow by user."""
|
|
||||||
|
|
||||||
# show form
|
|
||||||
result = await hass.config_entries.flow.async_init(
|
|
||||||
DOMAIN, context={"source": "user"}
|
|
||||||
)
|
|
||||||
assert result["type"] == "form"
|
|
||||||
assert result["step_id"] == "user"
|
|
||||||
assert len(result["errors"]) == 0
|
|
||||||
|
|
||||||
|
|
||||||
async def test_user_error(hass, remote):
|
async def test_user_error(hass, remote):
|
||||||
"""Test starting a flow by user with errors."""
|
"""Test starting a flow by user with errors."""
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user