Drop owntracks import flow (#64967)
This commit is contained in:
parent
9079734348
commit
f92e8ab931
3 changed files with 25 additions and 62 deletions
|
@ -76,21 +76,8 @@ async def test_user(hass, webhook_id, secret):
|
|||
assert result["description_placeholders"][CONF_WEBHOOK_URL] == WEBHOOK_URL
|
||||
|
||||
|
||||
async def test_import(hass, webhook_id, secret):
|
||||
"""Test import step."""
|
||||
flow = await init_config_flow(hass)
|
||||
|
||||
result = await flow.async_step_import({})
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["title"] == "OwnTracks"
|
||||
assert result["data"][CONF_WEBHOOK_ID] == WEBHOOK_ID
|
||||
assert result["data"][CONF_SECRET] == SECRET
|
||||
assert result["data"][CONF_CLOUDHOOK] == CLOUDHOOK
|
||||
assert result["description_placeholders"] is None
|
||||
|
||||
|
||||
async def test_import_setup(hass):
|
||||
"""Test that we automatically create a config flow."""
|
||||
"""Test that we don't automatically create a config entry."""
|
||||
await async_process_ha_core_config(
|
||||
hass,
|
||||
{"external_url": "http://example.com"},
|
||||
|
@ -99,7 +86,7 @@ async def test_import_setup(hass):
|
|||
assert not hass.config_entries.async_entries(DOMAIN)
|
||||
assert await async_setup_component(hass, DOMAIN, {"owntracks": {}})
|
||||
await hass.async_block_till_done()
|
||||
assert hass.config_entries.async_entries(DOMAIN)
|
||||
assert not hass.config_entries.async_entries(DOMAIN)
|
||||
|
||||
|
||||
async def test_abort_if_already_setup(hass):
|
||||
|
@ -109,11 +96,6 @@ async def test_abort_if_already_setup(hass):
|
|||
MockConfigEntry(domain=DOMAIN, data={}).add_to_hass(hass)
|
||||
assert hass.config_entries.async_entries(DOMAIN)
|
||||
|
||||
# Should fail, already setup (import)
|
||||
result = await flow.async_step_import({})
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["reason"] == "single_instance_allowed"
|
||||
|
||||
# Should fail, already setup (flow)
|
||||
result = await flow.async_step_user({})
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
|
@ -143,7 +125,7 @@ async def test_unload(hass):
|
|||
"homeassistant.config_entries.ConfigEntries.async_forward_entry_setup"
|
||||
) as mock_forward:
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_IMPORT}, data={}
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}, data={}
|
||||
)
|
||||
|
||||
assert len(mock_forward.mock_calls) == 1
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue