diff --git a/homeassistant/components/enphase_envoy/quality_scale.yaml b/homeassistant/components/enphase_envoy/quality_scale.yaml index 8e096538f01..d64a62d4a48 100644 --- a/homeassistant/components/enphase_envoy/quality_scale.yaml +++ b/homeassistant/components/enphase_envoy/quality_scale.yaml @@ -11,13 +11,10 @@ rules: config-flow-test-coverage: status: todo 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) - 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:: 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: status: todo comment: | diff --git a/tests/components/enphase_envoy/test_config_flow.py b/tests/components/enphase_envoy/test_config_flow.py index 44e2e680d5f..b0b139053ce 100644 --- a/tests/components/enphase_envoy/test_config_flow.py +++ b/tests/components/enphase_envoy/test_config_flow.py @@ -49,6 +49,7 @@ async def test_form( ) assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "Envoy 1234" + assert result["result"].unique_id == "1234" assert result["data"] == { CONF_HOST: "1.1.1.1", CONF_NAME: "Envoy 1234", @@ -80,6 +81,7 @@ async def test_user_no_serial_number( ) assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "Envoy" + assert result["result"].unique_id is None assert result["data"] == { CONF_HOST: "1.1.1.1", CONF_NAME: "Envoy", @@ -100,6 +102,8 @@ async def test_form_invalid_auth( result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER} ) + assert result["type"] is FlowResultType.FORM + result2 = await hass.config_entries.flow.async_configure( result["flow_id"], { @@ -131,6 +135,8 @@ async def test_form_cannot_connect( result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER} ) + assert result["type"] is FlowResultType.FORM + result = await hass.config_entries.flow.async_configure( result["flow_id"], { @@ -634,6 +640,8 @@ async def test_reauth( """Test we reauth auth.""" await setup_integration(hass, config_entry) result = await config_entry.start_reauth_flow(hass) + assert result["type"] is FlowResultType.FORM + result2 = await hass.config_entries.flow.async_configure( result["flow_id"], {