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

Use config_entries.SOURCE_* constants (#49631)

This commit is contained in:
Ville Skyttä
2021-04-25 12:27:40 +03:00
committed by GitHub
parent 34a588d1ba
commit 153d6e891e
103 changed files with 723 additions and 488 deletions

View File

@@ -3,6 +3,7 @@ from unittest.mock import AsyncMock, MagicMock, PropertyMock, patch
import pytest
from homeassistant import config_entries
from homeassistant.components.tibber.const import DOMAIN
from homeassistant.const import CONF_ACCESS_TOKEN
@@ -19,7 +20,7 @@ def tibber_setup_fixture():
async def test_show_config_form(hass):
"""Test show configuration form."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": "user"}
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
assert result["type"] == "form"
@@ -42,7 +43,7 @@ async def test_create_entry(hass):
with patch("tibber.Tibber", return_value=tibber_mock):
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": "user"}, data=test_data
DOMAIN, context={"source": config_entries.SOURCE_USER}, data=test_data
)
assert result["type"] == "create_entry"
@@ -65,7 +66,7 @@ async def test_flow_entry_already_exists(hass):
with patch("tibber.Tibber.update_info", return_value=None):
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": "user"}, data=test_data
DOMAIN, context={"source": config_entries.SOURCE_USER}, data=test_data
)
assert result["type"] == "abort"