mirror of
https://github.com/home-assistant/core.git
synced 2025-07-27 07:07:28 +00:00
Add missing asserts to enphase_envoy config flow test (#133730)
This commit is contained in:
parent
9292bfc6ed
commit
ef31413a59
@ -11,13 +11,10 @@ rules:
|
|||||||
config-flow-test-coverage:
|
config-flow-test-coverage:
|
||||||
status: todo
|
status: todo
|
||||||
comment: |
|
comment: |
|
||||||
- test_form is missing an assertion for the unique id of the resulting entry
|
|
||||||
- Let's also have test_user_no_serial_number assert the unique_id (as in, it can't be set to the serial_number since we dont have one, so let's assert what it will result in)
|
|
||||||
- Let's have every test result in either CREATE_ENTRY or ABORT (like test_form_invalid_auth or test_form_cannot_connect, they can be parametrized)
|
- Let's have every test result in either CREATE_ENTRY or ABORT (like test_form_invalid_auth or test_form_cannot_connect, they can be parametrized)
|
||||||
- test_zeroconf_token_firmware and test_zeroconf_pre_token_firmware can also be parametrized I think
|
- test_zeroconf_token_firmware and test_zeroconf_pre_token_firmware can also be parametrized I think
|
||||||
- test_zero_conf_malformed_serial_property - with pytest.raises(KeyError) as ex::
|
- test_zero_conf_malformed_serial_property - with pytest.raises(KeyError) as ex::
|
||||||
I don't believe this should be able to raise a KeyError Shouldn't we abort the flow?
|
I don't believe this should be able to raise a KeyError Shouldn't we abort the flow?
|
||||||
test_reauth -> Let's also assert result before we start with the async_configure part
|
|
||||||
config-flow:
|
config-flow:
|
||||||
status: todo
|
status: todo
|
||||||
comment: |
|
comment: |
|
||||||
|
@ -49,6 +49,7 @@ async def test_form(
|
|||||||
)
|
)
|
||||||
assert result["type"] is FlowResultType.CREATE_ENTRY
|
assert result["type"] is FlowResultType.CREATE_ENTRY
|
||||||
assert result["title"] == "Envoy 1234"
|
assert result["title"] == "Envoy 1234"
|
||||||
|
assert result["result"].unique_id == "1234"
|
||||||
assert result["data"] == {
|
assert result["data"] == {
|
||||||
CONF_HOST: "1.1.1.1",
|
CONF_HOST: "1.1.1.1",
|
||||||
CONF_NAME: "Envoy 1234",
|
CONF_NAME: "Envoy 1234",
|
||||||
@ -80,6 +81,7 @@ async def test_user_no_serial_number(
|
|||||||
)
|
)
|
||||||
assert result["type"] is FlowResultType.CREATE_ENTRY
|
assert result["type"] is FlowResultType.CREATE_ENTRY
|
||||||
assert result["title"] == "Envoy"
|
assert result["title"] == "Envoy"
|
||||||
|
assert result["result"].unique_id is None
|
||||||
assert result["data"] == {
|
assert result["data"] == {
|
||||||
CONF_HOST: "1.1.1.1",
|
CONF_HOST: "1.1.1.1",
|
||||||
CONF_NAME: "Envoy",
|
CONF_NAME: "Envoy",
|
||||||
@ -100,6 +102,8 @@ async def test_form_invalid_auth(
|
|||||||
result = await hass.config_entries.flow.async_init(
|
result = await hass.config_entries.flow.async_init(
|
||||||
DOMAIN, context={"source": SOURCE_USER}
|
DOMAIN, context={"source": SOURCE_USER}
|
||||||
)
|
)
|
||||||
|
assert result["type"] is FlowResultType.FORM
|
||||||
|
|
||||||
result2 = await hass.config_entries.flow.async_configure(
|
result2 = await hass.config_entries.flow.async_configure(
|
||||||
result["flow_id"],
|
result["flow_id"],
|
||||||
{
|
{
|
||||||
@ -131,6 +135,8 @@ async def test_form_cannot_connect(
|
|||||||
result = await hass.config_entries.flow.async_init(
|
result = await hass.config_entries.flow.async_init(
|
||||||
DOMAIN, context={"source": SOURCE_USER}
|
DOMAIN, context={"source": SOURCE_USER}
|
||||||
)
|
)
|
||||||
|
assert result["type"] is FlowResultType.FORM
|
||||||
|
|
||||||
result = await hass.config_entries.flow.async_configure(
|
result = await hass.config_entries.flow.async_configure(
|
||||||
result["flow_id"],
|
result["flow_id"],
|
||||||
{
|
{
|
||||||
@ -634,6 +640,8 @@ async def test_reauth(
|
|||||||
"""Test we reauth auth."""
|
"""Test we reauth auth."""
|
||||||
await setup_integration(hass, config_entry)
|
await setup_integration(hass, config_entry)
|
||||||
result = await config_entry.start_reauth_flow(hass)
|
result = await config_entry.start_reauth_flow(hass)
|
||||||
|
assert result["type"] is FlowResultType.FORM
|
||||||
|
|
||||||
result2 = await hass.config_entries.flow.async_configure(
|
result2 = await hass.config_entries.flow.async_configure(
|
||||||
result["flow_id"],
|
result["flow_id"],
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user