mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Move imports to top for ambient_station (#29497)
This commit is contained in:
parent
a050d54847
commit
564fed7879
@ -8,8 +8,8 @@ import voluptuous as vol
|
|||||||
|
|
||||||
from homeassistant.config_entries import SOURCE_IMPORT
|
from homeassistant.config_entries import SOURCE_IMPORT
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
ATTR_NAME,
|
|
||||||
ATTR_LOCATION,
|
ATTR_LOCATION,
|
||||||
|
ATTR_NAME,
|
||||||
CONF_API_KEY,
|
CONF_API_KEY,
|
||||||
EVENT_HOMEASSISTANT_STOP,
|
EVENT_HOMEASSISTANT_STOP,
|
||||||
)
|
)
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
"""Config flow to configure the Ambient PWS component."""
|
"""Config flow to configure the Ambient PWS component."""
|
||||||
|
from aioambient import Client
|
||||||
|
from aioambient.errors import AmbientError
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant import config_entries
|
from homeassistant import config_entries
|
||||||
@ -40,8 +42,6 @@ class AmbientStationFlowHandler(config_entries.ConfigFlow):
|
|||||||
|
|
||||||
async def async_step_user(self, user_input=None):
|
async def async_step_user(self, user_input=None):
|
||||||
"""Handle the start of the config flow."""
|
"""Handle the start of the config flow."""
|
||||||
from aioambient import Client
|
|
||||||
from aioambient.errors import AmbientError
|
|
||||||
|
|
||||||
if not user_input:
|
if not user_input:
|
||||||
return await self._show_form()
|
return await self._show_form()
|
||||||
|
@ -3,12 +3,13 @@ import json
|
|||||||
|
|
||||||
import aioambient
|
import aioambient
|
||||||
import pytest
|
import pytest
|
||||||
|
from unittest.mock import patch
|
||||||
|
|
||||||
from homeassistant import data_entry_flow
|
from homeassistant import data_entry_flow
|
||||||
from homeassistant.components.ambient_station import CONF_APP_KEY, DOMAIN, config_flow
|
from homeassistant.components.ambient_station import CONF_APP_KEY, DOMAIN, config_flow
|
||||||
from homeassistant.const import CONF_API_KEY
|
from homeassistant.const import CONF_API_KEY
|
||||||
|
|
||||||
from tests.common import load_fixture, MockConfigEntry, MockDependency, mock_coro
|
from tests.common import load_fixture, MockConfigEntry, mock_coro
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
@ -20,9 +21,9 @@ def get_devices_response():
|
|||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def mock_aioambient(get_devices_response):
|
def mock_aioambient(get_devices_response):
|
||||||
"""Mock the aioambient library."""
|
"""Mock the aioambient library."""
|
||||||
with MockDependency("aioambient") as mock_aioambient_:
|
with patch("homeassistant.components.ambient_station.config_flow.Client") as Client:
|
||||||
mock_aioambient_.Client().api.get_devices.return_value = get_devices_response
|
Client().api.get_devices.return_value = get_devices_response
|
||||||
yield mock_aioambient_
|
yield Client
|
||||||
|
|
||||||
|
|
||||||
async def test_duplicate_error(hass):
|
async def test_duplicate_error(hass):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user