Skip to content

Commit

Permalink
Fix config flow tests
Browse files Browse the repository at this point in the history
  • Loading branch information
golles committed Jan 29, 2025
1 parent 88f8007 commit 5f64cc7
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions tests/test_config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def bypass_setup_fixture():
yield


# Here we simiulate a successful config flow from the backend.
# Here we simulate a successful config flow from the backend.
# Note that we use the `bypass_get_data` fixture here because
# we want the config flow validation to succeed during the test.
async def test_successful_config_flow(hass: HomeAssistant, bypass_get_data):
Expand All @@ -37,7 +37,7 @@ async def test_successful_config_flow(hass: HomeAssistant, bypass_get_data):
)

# Check that the config flow shows the user form as the first step
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
assert result["type"] == data_entry_flow.FlowResultType.FORM
assert result["step_id"] == "user"

# If a user were to fill in all fields, it would result in this function call
Expand All @@ -47,7 +47,7 @@ async def test_successful_config_flow(hass: HomeAssistant, bypass_get_data):

# Check that the config flow is complete and a new entry is created with
# the input data
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
assert result["title"] == MOCK_CONFIG[CONF_PORT]
assert result["data"] == MOCK_CONFIG
assert result["result"]
Expand All @@ -64,14 +64,14 @@ async def test_failed_config_flow(hass: HomeAssistant, error_on_get_data):
DOMAIN, context={"source": config_entries.SOURCE_USER}
)

assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
assert result["type"] == data_entry_flow.FlowResultType.FORM
assert result["step_id"] == "user"

result = await hass.config_entries.flow.async_configure(
result["flow_id"], user_input=MOCK_CONFIG
)

assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
assert result["type"] == data_entry_flow.FlowResultType.FORM
assert "base" in result["errors"]


Expand All @@ -87,7 +87,7 @@ async def test_options_flow(hass: HomeAssistant):
result = await hass.config_entries.options.async_init(entry.entry_id)

# Verify that the first options step is a user form
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
assert result["type"] == data_entry_flow.FlowResultType.FORM
assert result["step_id"] == "user"

# Enter some fake data into the form
Expand All @@ -97,7 +97,7 @@ async def test_options_flow(hass: HomeAssistant):
)

# Verify that the flow finishes
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
assert result["title"] == MOCK_CONFIG[CONF_PORT]

# Verify that the options were updated
Expand Down

0 comments on commit 5f64cc7

Please sign in to comment.