mirror of
https://github.com/home-assistant/core.git
synced 2025-07-07 21:37:07 +00:00
Fix some mistakes in the Habitica tests (#143465)
This commit is contained in:
parent
00fc3e2c29
commit
bf1c138a3c
@ -76,8 +76,9 @@ async def test_form_login(hass: HomeAssistant, mock_setup_entry: AsyncMock) -> N
|
|||||||
assert "login" in result["menu_options"]
|
assert "login" in result["menu_options"]
|
||||||
assert result["step_id"] == "user"
|
assert result["step_id"] == "user"
|
||||||
|
|
||||||
result = await hass.config_entries.flow.async_init(
|
result = await hass.config_entries.flow.async_configure(
|
||||||
DOMAIN, context={"source": "login"}
|
result["flow_id"],
|
||||||
|
{"next_step_id": "login"},
|
||||||
)
|
)
|
||||||
assert result["type"] is FlowResultType.FORM
|
assert result["type"] is FlowResultType.FORM
|
||||||
assert result["errors"] == {}
|
assert result["errors"] == {}
|
||||||
@ -123,8 +124,9 @@ async def test_form_login_errors(
|
|||||||
assert result["type"] is FlowResultType.MENU
|
assert result["type"] is FlowResultType.MENU
|
||||||
assert result["step_id"] == "user"
|
assert result["step_id"] == "user"
|
||||||
|
|
||||||
result = await hass.config_entries.flow.async_init(
|
result = await hass.config_entries.flow.async_configure(
|
||||||
DOMAIN, context={"source": "login"}
|
result["flow_id"],
|
||||||
|
{"next_step_id": "login"},
|
||||||
)
|
)
|
||||||
|
|
||||||
habitica.login.side_effect = raise_error
|
habitica.login.side_effect = raise_error
|
||||||
@ -156,7 +158,7 @@ async def test_form_login_errors(
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.usefixtures("habitica")
|
@pytest.mark.usefixtures("habitica")
|
||||||
async def test_form__already_configured(
|
async def test_form_already_configured(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
config_entry: MockConfigEntry,
|
config_entry: MockConfigEntry,
|
||||||
) -> None:
|
) -> None:
|
||||||
@ -171,13 +173,14 @@ async def test_form__already_configured(
|
|||||||
assert result["type"] is FlowResultType.MENU
|
assert result["type"] is FlowResultType.MENU
|
||||||
assert result["step_id"] == "user"
|
assert result["step_id"] == "user"
|
||||||
|
|
||||||
result = await hass.config_entries.flow.async_init(
|
result = await hass.config_entries.flow.async_configure(
|
||||||
DOMAIN, context={"source": "advanced"}
|
result["flow_id"],
|
||||||
|
{"next_step_id": "login"},
|
||||||
)
|
)
|
||||||
|
|
||||||
result = await hass.config_entries.flow.async_configure(
|
result = await hass.config_entries.flow.async_configure(
|
||||||
result["flow_id"],
|
result["flow_id"],
|
||||||
user_input=MOCK_DATA_ADVANCED_STEP,
|
user_input=MOCK_DATA_LOGIN_STEP,
|
||||||
)
|
)
|
||||||
|
|
||||||
assert result["type"] is FlowResultType.ABORT
|
assert result["type"] is FlowResultType.ABORT
|
||||||
@ -196,19 +199,14 @@ async def test_form_advanced(hass: HomeAssistant, mock_setup_entry: AsyncMock) -
|
|||||||
assert "advanced" in result["menu_options"]
|
assert "advanced" in result["menu_options"]
|
||||||
assert result["step_id"] == "user"
|
assert result["step_id"] == "user"
|
||||||
|
|
||||||
result = await hass.config_entries.flow.async_init(
|
result = await hass.config_entries.flow.async_configure(
|
||||||
DOMAIN, context={"source": "advanced"}
|
result["flow_id"],
|
||||||
|
{"next_step_id": "advanced"},
|
||||||
)
|
)
|
||||||
assert result["type"] is FlowResultType.FORM
|
assert result["type"] is FlowResultType.FORM
|
||||||
assert result["errors"] == {}
|
assert result["errors"] == {}
|
||||||
assert result["step_id"] == "advanced"
|
assert result["step_id"] == "advanced"
|
||||||
|
|
||||||
result = await hass.config_entries.flow.async_init(
|
|
||||||
DOMAIN, context={"source": "advanced"}
|
|
||||||
)
|
|
||||||
assert result["type"] is FlowResultType.FORM
|
|
||||||
assert result["errors"] == {}
|
|
||||||
|
|
||||||
result = await hass.config_entries.flow.async_configure(
|
result = await hass.config_entries.flow.async_configure(
|
||||||
result["flow_id"],
|
result["flow_id"],
|
||||||
user_input=MOCK_DATA_ADVANCED_STEP,
|
user_input=MOCK_DATA_ADVANCED_STEP,
|
||||||
@ -249,8 +247,9 @@ async def test_form_advanced_errors(
|
|||||||
assert result["type"] is FlowResultType.MENU
|
assert result["type"] is FlowResultType.MENU
|
||||||
assert result["step_id"] == "user"
|
assert result["step_id"] == "user"
|
||||||
|
|
||||||
result = await hass.config_entries.flow.async_init(
|
result = await hass.config_entries.flow.async_configure(
|
||||||
DOMAIN, context={"source": "advanced"}
|
result["flow_id"],
|
||||||
|
{"next_step_id": "advanced"},
|
||||||
)
|
)
|
||||||
|
|
||||||
habitica.get_user.side_effect = raise_error
|
habitica.get_user.side_effect = raise_error
|
||||||
@ -298,8 +297,9 @@ async def test_form_advanced_already_configured(
|
|||||||
assert result["type"] is FlowResultType.MENU
|
assert result["type"] is FlowResultType.MENU
|
||||||
assert result["step_id"] == "user"
|
assert result["step_id"] == "user"
|
||||||
|
|
||||||
result = await hass.config_entries.flow.async_init(
|
result = await hass.config_entries.flow.async_configure(
|
||||||
DOMAIN, context={"source": "advanced"}
|
result["flow_id"],
|
||||||
|
{"next_step_id": "advanced"},
|
||||||
)
|
)
|
||||||
|
|
||||||
result = await hass.config_entries.flow.async_configure(
|
result = await hass.config_entries.flow.async_configure(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user