Apply hass-relative-import to tests (a-c) (#78728)

pull/78742/head
epenet 2022-09-19 09:48:25 +02:00 committed by GitHub
parent 00dd27ef1b
commit c5a56dab42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
37 changed files with 65 additions and 67 deletions

View File

@ -1,8 +1,9 @@
"""Test AccuWeather diagnostics."""
import json
from . import init_integration
from tests.common import load_fixture
from tests.components.accuweather import init_integration
from tests.components.diagnostics import get_diagnostics_for_config_entry

View File

@ -10,8 +10,9 @@ from homeassistant.config_entries import ConfigEntryState
from homeassistant.const import STATE_UNAVAILABLE
from homeassistant.util.dt import utcnow
from . import init_integration
from tests.common import MockConfigEntry, async_fire_time_changed, load_fixture
from tests.components.accuweather import init_integration
async def test_async_setup_entry(hass):

View File

@ -32,8 +32,9 @@ from homeassistant.setup import async_setup_component
from homeassistant.util.dt import utcnow
from homeassistant.util.unit_system import IMPERIAL_SYSTEM
from . import init_integration
from tests.common import async_fire_time_changed, load_fixture
from tests.components.accuweather import init_integration
async def test_sensor_without_forecast(hass):

View File

@ -27,8 +27,9 @@ from homeassistant.helpers import entity_registry as er
from homeassistant.setup import async_setup_component
from homeassistant.util.dt import utcnow
from . import init_integration
from tests.common import async_fire_time_changed, load_fixture
from tests.components.accuweather import init_integration
async def test_weather_without_forecast(hass):

View File

@ -6,8 +6,7 @@ from homeassistant.const import STATE_OFF, STATE_ON
from homeassistant.helpers import entity_registry as er
from homeassistant.util import dt
from tests.common import async_fire_time_changed
from tests.components.advantage_air import (
from . import (
TEST_SET_RESPONSE,
TEST_SET_URL,
TEST_SYSTEM_DATA,
@ -15,6 +14,8 @@ from tests.components.advantage_air import (
add_mock_config,
)
from tests.common import async_fire_time_changed
async def test_binary_sensor_async_setup_entry(hass, aioclient_mock):
"""Test binary sensor setup."""

View File

@ -5,7 +5,7 @@ from unittest.mock import patch
from homeassistant import config_entries, data_entry_flow
from homeassistant.components.advantage_air.const import DOMAIN
from tests.components.advantage_air import TEST_SYSTEM_DATA, TEST_SYSTEM_URL, USER_INPUT
from . import TEST_SYSTEM_DATA, TEST_SYSTEM_URL, USER_INPUT
async def test_form(hass, aioclient_mock):

View File

@ -17,7 +17,7 @@ from homeassistant.components.cover import (
from homeassistant.const import ATTR_ENTITY_ID, STATE_OPEN
from homeassistant.helpers import entity_registry as er
from tests.components.advantage_air import (
from . import (
TEST_SET_RESPONSE,
TEST_SET_URL,
TEST_SYSTEM_DATA,

View File

@ -2,11 +2,7 @@
from homeassistant.config_entries import ConfigEntryState
from tests.components.advantage_air import (
TEST_SYSTEM_DATA,
TEST_SYSTEM_URL,
add_mock_config,
)
from . import TEST_SYSTEM_DATA, TEST_SYSTEM_URL, add_mock_config
async def test_async_setup_entry(hass, aioclient_mock):

View File

@ -14,7 +14,7 @@ from homeassistant.components.light import (
from homeassistant.const import ATTR_ENTITY_ID, STATE_OFF
from homeassistant.helpers import entity_registry as er
from tests.components.advantage_air import (
from . import (
TEST_SET_LIGHT_URL,
TEST_SET_RESPONSE,
TEST_SYSTEM_DATA,

View File

@ -9,7 +9,7 @@ from homeassistant.components.select.const import (
from homeassistant.const import ATTR_ENTITY_ID
from homeassistant.helpers import entity_registry as er
from tests.components.advantage_air import (
from . import (
TEST_SET_RESPONSE,
TEST_SET_URL,
TEST_SYSTEM_DATA,

View File

@ -13,8 +13,7 @@ from homeassistant.const import ATTR_ENTITY_ID
from homeassistant.helpers import entity_registry as er
from homeassistant.util import dt
from tests.common import async_fire_time_changed
from tests.components.advantage_air import (
from . import (
TEST_SET_RESPONSE,
TEST_SET_URL,
TEST_SYSTEM_DATA,
@ -22,6 +21,8 @@ from tests.components.advantage_air import (
add_mock_config,
)
from tests.common import async_fire_time_changed
async def test_sensor_platform(hass, aioclient_mock):
"""Test sensor platform."""

View File

@ -13,7 +13,7 @@ from homeassistant.components.switch import (
from homeassistant.const import ATTR_ENTITY_ID, STATE_OFF
from homeassistant.helpers import entity_registry as er
from tests.components.advantage_air import (
from . import (
TEST_SET_RESPONSE,
TEST_SET_URL,
TEST_SYSTEM_DATA,

View File

@ -3,8 +3,9 @@
from homeassistant.const import STATE_ON
from homeassistant.helpers import entity_registry as er
from . import TEST_SYSTEM_URL, add_mock_config
from tests.common import load_fixture
from tests.components.advantage_air import TEST_SYSTEM_URL, add_mock_config
async def test_update_platform(hass, aioclient_mock):

View File

@ -7,9 +7,8 @@ from homeassistant.components.agent_dvr.const import DOMAIN
from homeassistant.config_entries import ConfigEntryState
from homeassistant.core import HomeAssistant
from . import CONF_DATA, create_entry
from . import CONF_DATA, create_entry, init_integration
from tests.components.agent_dvr import init_integration
from tests.test_util.aiohttp import AiohttpClientMocker

View File

@ -3,8 +3,9 @@ import json
from homeassistant.components.diagnostics import REDACTED
from . import init_integration
from tests.common import load_fixture
from tests.components.airly import init_integration
from tests.components.diagnostics import get_diagnostics_for_config_entry

View File

@ -11,7 +11,7 @@ from homeassistant.const import STATE_UNAVAILABLE
from homeassistant.helpers import entity_registry as er
from homeassistant.util.dt import utcnow
from . import API_POINT_URL
from . import API_POINT_URL, init_integration
from tests.common import (
MockConfigEntry,
@ -19,7 +19,6 @@ from tests.common import (
load_fixture,
mock_device_registry,
)
from tests.components.airly import init_integration
async def test_async_setup_entry(hass, aioclient_mock):

View File

@ -22,10 +22,9 @@ from homeassistant.helpers import entity_registry as er
from homeassistant.setup import async_setup_component
from homeassistant.util.dt import utcnow
from . import API_POINT_URL
from . import API_POINT_URL, init_integration
from tests.common import async_fire_time_changed, load_fixture
from tests.components.airly import init_integration
async def test_sensor(hass, aioclient_mock):

View File

@ -19,12 +19,9 @@ from homeassistant.components.amberelectric.const import (
from homeassistant.core import HomeAssistant
from homeassistant.setup import async_setup_component
from .helpers import GENERAL_CHANNEL, GENERAL_ONLY_SITE_ID, generate_current_interval
from tests.common import MockConfigEntry
from tests.components.amberelectric.helpers import (
GENERAL_CHANNEL,
GENERAL_ONLY_SITE_ID,
generate_current_interval,
)
MOCK_API_TOKEN = "psk_0000000000000000"

View File

@ -19,7 +19,7 @@ from homeassistant.components.amberelectric.coordinator import (
from homeassistant.core import HomeAssistant
from homeassistant.helpers.update_coordinator import UpdateFailed
from tests.components.amberelectric.helpers import (
from .helpers import (
CONTROLLED_LOAD_CHANNEL,
FEED_IN_CHANNEL,
GENERAL_AND_CONTROLLED_SITE_ID,

View File

@ -15,8 +15,7 @@ from homeassistant.components.amberelectric.const import (
from homeassistant.core import HomeAssistant
from homeassistant.setup import async_setup_component
from tests.common import MockConfigEntry
from tests.components.amberelectric.helpers import (
from .helpers import (
CONTROLLED_LOAD_CHANNEL,
FEED_IN_CHANNEL,
GENERAL_AND_CONTROLLED_SITE_ID,
@ -25,6 +24,8 @@ from tests.components.amberelectric.helpers import (
GENERAL_ONLY_SITE_ID,
)
from tests.common import MockConfigEntry
MOCK_API_TOKEN = "psk_0000000000000000"

View File

@ -23,7 +23,8 @@ from homeassistant.core import HomeAssistant
from homeassistant.helpers import entity_registry as er
from homeassistant.setup import async_setup_component
from tests.components.atag import UID, init_integration
from . import UID, init_integration
from tests.test_util.aiohttp import AiohttpClientMocker
CLIMATE_ID = f"{Platform.CLIMATE}.{DOMAIN}"

View File

@ -3,7 +3,8 @@ from homeassistant.components.atag.sensor import SENSORS
from homeassistant.core import HomeAssistant
from homeassistant.helpers import entity_registry as er
from tests.components.atag import UID, init_integration
from . import UID, init_integration
from tests.test_util.aiohttp import AiohttpClientMocker

View File

@ -10,7 +10,8 @@ from homeassistant.const import ATTR_ENTITY_ID, ATTR_TEMPERATURE, Platform
from homeassistant.core import HomeAssistant
from homeassistant.helpers import entity_registry as er
from tests.components.atag import UID, init_integration
from . import UID, init_integration
from tests.test_util.aiohttp import AiohttpClientMocker
WATER_HEATER_ID = f"{Platform.WATER_HEATER}.{DOMAIN}"

View File

@ -17,8 +17,7 @@ from homeassistant.const import (
from homeassistant.helpers import device_registry as dr
import homeassistant.util.dt as dt_util
from tests.common import async_fire_time_changed
from tests.components.august.mocks import (
from .mocks import (
_create_august_with_devices,
_mock_activities_from_fixture,
_mock_doorbell_from_fixture,
@ -26,6 +25,8 @@ from tests.components.august.mocks import (
_mock_lock_from_fixture,
)
from tests.common import async_fire_time_changed
def _timetoken():
return str(time.time_ns())[:-2]

View File

@ -4,10 +4,7 @@ from homeassistant.components.button import DOMAIN as BUTTON_DOMAIN
from homeassistant.components.button.const import SERVICE_PRESS
from homeassistant.const import ATTR_ENTITY_ID
from tests.components.august.mocks import (
_create_august_api_with_devices,
_mock_lock_from_fixture,
)
from .mocks import _create_august_api_with_devices, _mock_lock_from_fixture
async def test_wake_lock(hass):

View File

@ -5,10 +5,7 @@ from unittest.mock import patch
from homeassistant.const import STATE_IDLE
from tests.components.august.mocks import (
_create_august_with_devices,
_mock_doorbell_from_fixture,
)
from .mocks import _create_august_with_devices, _mock_doorbell_from_fixture
async def test_create_doorbell(hass, hass_client_no_auth):

View File

@ -1,10 +1,11 @@
"""Test august diagnostics."""
from tests.components.august.mocks import (
from .mocks import (
_create_august_api_with_devices,
_mock_doorbell_from_fixture,
_mock_lock_from_fixture,
)
from tests.components.diagnostics import get_diagnostics_for_config_entry

View File

@ -6,7 +6,7 @@ from yalexs.authenticator_common import AuthenticationState
from homeassistant.components.august.const import DOMAIN
from homeassistant.components.august.gateway import AugustGateway
from tests.components.august.mocks import _mock_august_authentication, _mock_get_config
from .mocks import _mock_august_authentication, _mock_get_config
async def test_refresh_access_token(hass):

View File

@ -21,8 +21,7 @@ from homeassistant.helpers import device_registry as dr, entity_registry as er
from homeassistant.helpers.entity_registry import EntityRegistry
from homeassistant.setup import async_setup_component
from tests.common import MockConfigEntry
from tests.components.august.mocks import (
from .mocks import (
_create_august_with_devices,
_mock_august_authentication,
_mock_doorsense_enabled_august_lock_detail,
@ -33,6 +32,8 @@ from tests.components.august.mocks import (
_mock_operative_august_lock_detail,
)
from tests.common import MockConfigEntry
async def test_august_api_is_failing(hass):
"""Config entry state is SETUP_RETRY when august api is failing."""

View File

@ -24,14 +24,15 @@ from homeassistant.const import (
from homeassistant.helpers import device_registry as dr, entity_registry as er
import homeassistant.util.dt as dt_util
from tests.common import async_fire_time_changed
from tests.components.august.mocks import (
from .mocks import (
_create_august_with_devices,
_mock_activities_from_fixture,
_mock_doorsense_enabled_august_lock_detail,
_mock_lock_from_fixture,
)
from tests.common import async_fire_time_changed
async def test_lock_device_registry(hass):
"""Test creation of a lock with doorsense and bridge ands up in the registry."""

View File

@ -2,7 +2,7 @@
from homeassistant.const import ATTR_UNIT_OF_MEASUREMENT, PERCENTAGE, STATE_UNKNOWN
from homeassistant.helpers import entity_registry as er
from tests.components.august.mocks import (
from .mocks import (
_create_august_with_devices,
_mock_activities_from_fixture,
_mock_doorbell_from_fixture,

View File

@ -9,8 +9,9 @@ from aiohttp import ClientSession
from homeassistant.core import HomeAssistant
from homeassistant.util.dt import UTC
from . import init_integration
from tests.common import load_fixture
from tests.components.brother import init_integration
from tests.components.diagnostics import get_diagnostics_for_config_entry

View File

@ -9,8 +9,9 @@ from homeassistant.config_entries import ConfigEntryState
from homeassistant.const import CONF_HOST, CONF_TYPE, STATE_UNAVAILABLE
from homeassistant.core import HomeAssistant
from . import init_integration
from tests.common import MockConfigEntry
from tests.components.brother import init_integration
async def test_async_setup_entry(hass: HomeAssistant) -> None:

View File

@ -24,8 +24,9 @@ from homeassistant.helpers import entity_registry as er
from homeassistant.setup import async_setup_component
from homeassistant.util.dt import UTC, utcnow
from . import init_integration
from tests.common import async_fire_time_changed, load_fixture
from tests.components.brother import init_integration
ATTR_REMAINING_PAGES = "remaining_pages"
ATTR_COUNTER = "counter"

View File

@ -5,7 +5,8 @@ from homeassistant.components.bsblan.const import DOMAIN
from homeassistant.config_entries import ConfigEntryState
from homeassistant.core import HomeAssistant
from tests.components.bsblan import init_integration, init_integration_without_auth
from . import init_integration, init_integration_without_auth
from tests.test_util.aiohttp import AiohttpClientMocker

View File

@ -10,11 +10,8 @@ from .common import (
mock_get_exchange_rates,
mocked_get_accounts,
)
from .const import MOCK_ACCOUNTS_RESPONSE_REDACTED, MOCK_ENTRY_REDACTED
from tests.components.coinbase.const import (
MOCK_ACCOUNTS_RESPONSE_REDACTED,
MOCK_ENTRY_REDACTED,
)
from tests.components.diagnostics import get_diagnostics_for_config_entry

View File

@ -24,12 +24,9 @@ from homeassistant.core import Context, CoreState, State
from homeassistant.helpers import entity_registry as er
from homeassistant.setup import async_setup_component
from .common import async_decrement, async_increment, async_reset
from tests.common import mock_restore_cache
from tests.components.counter.common import (
async_decrement,
async_increment,
async_reset,
)
_LOGGER = logging.getLogger(__name__)