Move imports to top for ambient_station (#29497)
This commit is contained in:
1 parent
a050d54847
commit
564fed7879
3 files changed
+8
-7
No files matched your search
@@ -8,8 +8,8 @@ import voluptuous as vol
|
||||
|
||||
from homeassistant.config_entries import SOURCE_IMPORT
|
||||
from homeassistant.const import (
|
||||
ATTR_NAME,
|
||||
ATTR_LOCATION,
|
||||
ATTR_NAME,
|
||||
CONF_API_KEY,
|
||||
EVENT_HOMEASSISTANT_STOP,
|
||||
)
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
"""Config flow to configure the Ambient PWS component."""
|
||||
from aioambient import Client
|
||||
from aioambient.errors import AmbientError
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant import config_entries
|
||||
@@ -40,8 +42,6 @@ class AmbientStationFlowHandler(config_entries.ConfigFlow):
|
||||
|
||||
async def async_step_user(self, user_input=None):
|
||||
"""Handle the start of the config flow."""
|
||||
from aioambient import Client
|
||||
from aioambient.errors import AmbientError
|
||||
|
||||
if not user_input:
|
||||
return await self._show_form()
|
||||
|
||||
@@ -3,12 +3,13 @@ import json
|
||||
|
||||
import aioambient
|
||||
import pytest
|
||||
from unittest.mock import patch
|
||||
|
||||
from homeassistant import data_entry_flow
|
||||
from homeassistant.components.ambient_station import CONF_APP_KEY, DOMAIN, config_flow
|
||||
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
|
||||
@@ -20,9 +21,9 @@ def get_devices_response():
|
||||
@pytest.fixture
|
||||
def mock_aioambient(get_devices_response):
|
||||
"""Mock the aioambient library."""
|
||||
with MockDependency("aioambient") as mock_aioambient_:
|
||||
mock_aioambient_.Client().api.get_devices.return_value = get_devices_response
|
||||
yield mock_aioambient_
|
||||
with patch("homeassistant.components.ambient_station.config_flow.Client") as Client:
|
||||
Client().api.get_devices.return_value = get_devices_response
|
||||
yield Client
|
||||
|
||||
|
||||
async def test_duplicate_error(hass):
|
||||
|
||||
Reference in new issue
Block a user