Skip to content

Commit

Permalink
fix: forward to post library step
Browse files Browse the repository at this point in the history
  • Loading branch information
bramstroker committed Jan 1, 2025
1 parent 8bed3b6 commit c3845e4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion custom_components/powercalc/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -1014,7 +1014,7 @@ async def _process_user_input(user_input: dict[str, Any]) -> dict[str, Any]:
PowercalcFormStep(
step=Step.LIBRARY_CUSTOM_FIELDS,
schema=build_dynamic_field_schema(self.selected_profile), # type: ignore
# next_step=Step.POST_LIBRARY,
next_step=Step.POST_LIBRARY,
validate_user_input=_process_user_input,

Check warning on line 1018 in custom_components/powercalc/config_flow.py

View workflow job for this annotation

GitHub Actions / Qodana Community for Python

Incorrect type

Expected type 'None', got '(user_input: Any) -\> Any' instead
),
user_input,
Expand Down
15 changes: 14 additions & 1 deletion tests/config_flow/test_virtual_power_library.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@
from homeassistant.core import HomeAssistant
from homeassistant.helpers.selector import SelectSelector

from custom_components.powercalc import CONF_CREATE_ENERGY_SENSOR, CONF_CREATE_UTILITY_METERS
from custom_components.powercalc import (
CONF_CREATE_ENERGY_SENSOR,
CONF_CREATE_UTILITY_METERS,
CONF_ENERGY_INTEGRATION_METHOD,
DEFAULT_ENERGY_INTEGRATION_METHOD,
)
from custom_components.powercalc.config_flow import (
CONF_CONFIRM_AUTODISCOVERED_MODEL,
Step,
Expand Down Expand Up @@ -229,10 +234,18 @@ async def test_profile_with_custom_fields(
{"some_entity": "sensor.foobar"},
)

assert result["type"] == data_entry_flow.FlowResultType.FORM
assert result["step_id"] == Step.POWER_ADVANCED
result = await hass.config_entries.flow.async_configure(
result["flow_id"],
{},
)

assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
assert result["data"] == {
CONF_CREATE_ENERGY_SENSOR: True,
CONF_CREATE_UTILITY_METERS: False,
CONF_ENERGY_INTEGRATION_METHOD: DEFAULT_ENERGY_INTEGRATION_METHOD,
CONF_ENTITY_ID: "sensor.test",
CONF_NAME: "test",
CONF_MANUFACTURER: "test",
Expand Down

0 comments on commit c3845e4

Please sign in to comment.