Add coronavirus integration (#32413)

* Add coronavirus integration

* Update homeassistant/components/coronavirus/manifest.json

Co-Authored-By: Franck Nijhof <git@frenck.dev>

Co-authored-by: Franck Nijhof <frenck@frenck.nl>
This commit is contained in:
authored and GitHub committed 2020-03-02 13:40:11 -08:00
1 parent 2ba514253c
commit 1603f7ac21
13 files changed
+271

No files matched your search

+1
View File
@@ -0,0 +1 @@
"""Tests for the Coronavirus integration."""
@@ -0,0 +1,33 @@
"""Test the Coronavirus config flow."""
from asynctest import patch
from homeassistant import config_entries, setup
from homeassistant.components.coronavirus.const import DOMAIN, OPTION_WORLDWIDE
async def test_form(hass):
"""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"] == {}
with patch("coronavirus.get_cases", return_value=[],), patch(
"homeassistant.components.coronavirus.async_setup", return_value=True
) as mock_setup, patch(
"homeassistant.components.coronavirus.async_setup_entry", return_value=True,
) as mock_setup_entry:
result2 = await hass.config_entries.flow.async_configure(
result["flow_id"], {"country": OPTION_WORLDWIDE},
)
assert result2["type"] == "create_entry"
assert result2["title"] == "Worldwide"
assert result2["data"] == {
"country": OPTION_WORLDWIDE,
}
await hass.async_block_till_done()
assert len(mock_setup.mock_calls) == 1
assert len(mock_setup_entry.mock_calls) == 1