Remove deprecated yaml and code cleanup for nfandroidtv (#73227)

This commit is contained in:
Rami Mosleh 2022-06-09 12:06:59 +03:00 committed by GitHub
parent 86723ea02b
commit a7398b8a73
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 38 additions and 147 deletions

View file

@ -4,8 +4,7 @@ from unittest.mock import patch
from notifications_android_tv.notifications import ConnectError
from homeassistant import config_entries, data_entry_flow
from homeassistant.components.nfandroidtv.const import DEFAULT_NAME, DOMAIN
from homeassistant.const import CONF_HOST, CONF_NAME
from homeassistant.components.nfandroidtv.const import DOMAIN
from . import (
CONF_CONFIG_FLOW,
@ -95,41 +94,3 @@ async def test_flow_user_unknown_error(hass):
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
assert result["step_id"] == "user"
assert result["errors"] == {"base": "unknown"}
async def test_flow_import(hass):
"""Test an import flow."""
mocked_tv = await _create_mocked_tv(True)
with _patch_config_flow_tv(mocked_tv), _patch_setup():
result = await hass.config_entries.flow.async_init(
DOMAIN,
context={"source": config_entries.SOURCE_IMPORT},
data=CONF_CONFIG_FLOW,
)
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
assert result["data"] == CONF_DATA
with _patch_config_flow_tv(mocked_tv), _patch_setup():
result = await hass.config_entries.flow.async_init(
DOMAIN,
context={"source": config_entries.SOURCE_IMPORT},
data=CONF_CONFIG_FLOW,
)
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
assert result["reason"] == "already_configured"
async def test_flow_import_missing_optional(hass):
"""Test an import flow with missing options."""
mocked_tv = await _create_mocked_tv(True)
with _patch_config_flow_tv(mocked_tv), _patch_setup():
result = await hass.config_entries.flow.async_init(
DOMAIN,
context={"source": config_entries.SOURCE_IMPORT},
data={CONF_HOST: HOST},
)
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
assert result["data"] == {CONF_HOST: HOST, CONF_NAME: f"{DEFAULT_NAME} {HOST}"}