Skip to content

Commit

Permalink
Try fixing test
Browse files Browse the repository at this point in the history
  • Loading branch information
dala318 committed Sep 4, 2024
1 parent 4bdfffc commit 3f5874f
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions tests/test_config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,44 @@

from unittest import mock

from config.custom_components.nordpool_planner.const import *
from custom_components.nordpool_planner import config_flow
import pytest
from pytest_homeassistant_custom_component.async_mock import patch
import voluptuous as vol

from custom_components.nordpool_planner import config_flow
from homeassistant import config_entries
from homeassistant.helpers import selector


NP_ENTITY_NAME = "sensor.nordpool_ent"

SCHEMA_COPY = vol.Schema(
{
vol.Required(CONF_NAME): str,
vol.Required(CONF_TYPE): selector.SelectSelector(
selector.SelectSelectorConfig(options=CONF_TYPE_LIST),
),
vol.Required(CONF_NP_ENTITY): selector.SelectSelector(
selector.SelectSelectorConfig(options=[NP_ENTITY_NAME]),
),
vol.Required(CONF_ACCEPT_COST_ENTITY, default=False): bool,
vol.Required(CONF_ACCEPT_RATE_ENTITY, default=False): bool,
vol.Required(CONF_HIGH_COST_ENTITY, default=False): bool,
}
)


@pytest.mark.asyncio
async def test_flow_init(hass):
"""Test the initial flow."""
result = await hass.config_entries.flow.async_init(
config_flow.DOMAIN, context={"source": "user"}
)

expected = {
"data_schema": config_flow.DATA_SCHEMA,
"data_schema": SCHEMA_COPY,
# "data_schema": config_flow.DATA_SCHEMA,
"description_placeholders": None,
"errors": {},
"flow_id": mock.ANY,
Expand Down

0 comments on commit 3f5874f

Please sign in to comment.