Skip to content

Commit

Permalink
Merge pull request #28 from firstof9/fix-tests
Browse files Browse the repository at this point in the history
Fix tests
  • Loading branch information
finity69x2 authored Dec 14, 2021
2 parents 0bc5a9f + 4d58d08 commit 4b7148d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion custom_components/nws_alerts/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def _get_default(key):
)


async def _get_zone_list(self):
async def _get_zone_list(self) -> list | None:
"""Return list of zone by lat/lon"""

data = None
Expand Down
20 changes: 13 additions & 7 deletions tests/test_config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,23 @@ async def test_form(
):
"""Test we get the form."""
await setup.async_setup_component(hass, "persistent_notification", {})
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
assert result["type"] == "form"
assert result["errors"] == {}
# assert result["title"] == title_1
with patch(
"custom_components.nws_alerts.config_flow._get_zone_list",
return_value=None):

result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
assert result["type"] == "form"
assert result["errors"] == {}
# assert result["title"] == title_1

with patch(
"custom_components.nws_alerts.async_setup_entry",
return_value=True,
) as mock_setup_entry:
) as mock_setup_entry, patch(
"custom_components.nws_alerts.config_flow._get_zone_list",
return_value=None):

result2 = await hass.config_entries.flow.async_configure(
result["flow_id"], input
Expand Down

0 comments on commit 4b7148d

Please sign in to comment.