1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00

Remove YAML config for Tile (#43064)

This commit is contained in:
Aaron Bach
2020-11-11 01:44:14 -07:00
committed by GitHub
parent 39cdf61c2d
commit 19f48e180c
3 changed files with 15 additions and 77 deletions

View File

@@ -3,7 +3,7 @@ from pytile.errors import TileError
from homeassistant import data_entry_flow
from homeassistant.components.tile import DOMAIN
from homeassistant.config_entries import SOURCE_IMPORT, SOURCE_USER
from homeassistant.config_entries import SOURCE_USER
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
from tests.async_mock import patch
@@ -12,10 +12,7 @@ from tests.common import MockConfigEntry
async def test_duplicate_error(hass):
"""Test that errors are shown when duplicates are added."""
conf = {
CONF_USERNAME: "user@host.com",
CONF_PASSWORD: "123abc",
}
conf = {CONF_USERNAME: "user@host.com", CONF_PASSWORD: "123abc"}
MockConfigEntry(domain=DOMAIN, unique_id="user@host.com", data=conf).add_to_hass(
hass
@@ -31,10 +28,7 @@ async def test_duplicate_error(hass):
async def test_invalid_credentials(hass):
"""Test that invalid credentials key throws an error."""
conf = {
CONF_USERNAME: "user@host.com",
CONF_PASSWORD: "123abc",
}
conf = {CONF_USERNAME: "user@host.com", CONF_PASSWORD: "123abc"}
with patch(
"homeassistant.components.tile.config_flow.async_login",
@@ -47,33 +41,9 @@ async def test_invalid_credentials(hass):
assert result["errors"] == {"base": "invalid_auth"}
async def test_step_import(hass):
"""Test that the import step works."""
conf = {
CONF_USERNAME: "user@host.com",
CONF_PASSWORD: "123abc",
}
with patch(
"homeassistant.components.tile.async_setup_entry", return_value=True
), patch("homeassistant.components.tile.config_flow.async_login"):
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": SOURCE_IMPORT}, data=conf
)
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
assert result["title"] == "user@host.com"
assert result["data"] == {
CONF_USERNAME: "user@host.com",
CONF_PASSWORD: "123abc",
}
async def test_step_user(hass):
"""Test that the user step works."""
conf = {
CONF_USERNAME: "user@host.com",
CONF_PASSWORD: "123abc",
}
conf = {CONF_USERNAME: "user@host.com", CONF_PASSWORD: "123abc"}
with patch(
"homeassistant.components.tile.async_setup_entry", return_value=True