Use supervisor envs instead of hassio (#72601)
This commit is contained in:
parent
c8f677ce4c
commit
3a0111e65d
17 changed files with 25 additions and 25 deletions
|
@ -1,2 +1,2 @@
|
|||
"""Tests for Hass.io component."""
|
||||
HASSIO_TOKEN = "123456"
|
||||
SUPERVISOR_TOKEN = "123456"
|
||||
|
|
|
@ -9,16 +9,16 @@ from homeassistant.core import CoreState
|
|||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from . import HASSIO_TOKEN
|
||||
from . import SUPERVISOR_TOKEN
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def hassio_env():
|
||||
"""Fixture to inject hassio env."""
|
||||
with patch.dict(os.environ, {"HASSIO": "127.0.0.1"}), patch(
|
||||
with patch.dict(os.environ, {"SUPERVISOR": "127.0.0.1"}), patch(
|
||||
"homeassistant.components.hassio.HassIO.is_connected",
|
||||
return_value={"result": "ok", "data": {}},
|
||||
), patch.dict(os.environ, {"HASSIO_TOKEN": HASSIO_TOKEN}), patch(
|
||||
), patch.dict(os.environ, {"SUPERVISOR_TOKEN": SUPERVISOR_TOKEN}), patch(
|
||||
"homeassistant.components.hassio.HassIO.get_info",
|
||||
Mock(side_effect=HassioAPIError()),
|
||||
):
|
||||
|
@ -75,5 +75,5 @@ def hassio_handler(hass, aioclient_mock):
|
|||
|
||||
websession = hass.loop.run_until_complete(get_client_session())
|
||||
|
||||
with patch.dict(os.environ, {"HASSIO_TOKEN": HASSIO_TOKEN}):
|
||||
with patch.dict(os.environ, {"SUPERVISOR_TOKEN": SUPERVISOR_TOKEN}):
|
||||
yield HassIO(hass.loop, websession, "127.0.0.1")
|
||||
|
|
|
@ -11,7 +11,7 @@ from homeassistant.setup import async_setup_component
|
|||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
MOCK_ENVIRON = {"HASSIO": "127.0.0.1", "HASSIO_TOKEN": "abcdefgh"}
|
||||
MOCK_ENVIRON = {"SUPERVISOR": "127.0.0.1", "SUPERVISOR_TOKEN": "abcdefgh"}
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
|
|
|
@ -13,7 +13,7 @@ from homeassistant.setup import async_setup_component
|
|||
from tests.common import MockConfigEntry
|
||||
from tests.components.diagnostics import get_diagnostics_for_config_entry
|
||||
|
||||
MOCK_ENVIRON = {"HASSIO": "127.0.0.1", "HASSIO_TOKEN": "abcdefgh"}
|
||||
MOCK_ENVIRON = {"SUPERVISOR": "127.0.0.1", "SUPERVISOR_TOKEN": "abcdefgh"}
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
|
|
|
@ -17,7 +17,7 @@ from homeassistant.util import dt as dt_util
|
|||
|
||||
from tests.common import MockConfigEntry, async_fire_time_changed
|
||||
|
||||
MOCK_ENVIRON = {"HASSIO": "127.0.0.1", "HASSIO_TOKEN": "abcdefgh"}
|
||||
MOCK_ENVIRON = {"SUPERVISOR": "127.0.0.1", "SUPERVISOR_TOKEN": "abcdefgh"}
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
|
@ -336,7 +336,7 @@ async def test_setup_core_push_timezone(hass, aioclient_mock):
|
|||
async def test_setup_hassio_no_additional_data(hass, aioclient_mock):
|
||||
"""Test setup with API push default data."""
|
||||
with patch.dict(os.environ, MOCK_ENVIRON), patch.dict(
|
||||
os.environ, {"HASSIO_TOKEN": "123456"}
|
||||
os.environ, {"SUPERVISOR_TOKEN": "123456"}
|
||||
):
|
||||
result = await async_setup_component(hass, "hassio", {"hassio": {}})
|
||||
assert result
|
||||
|
|
|
@ -11,7 +11,7 @@ from homeassistant.setup import async_setup_component
|
|||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
MOCK_ENVIRON = {"HASSIO": "127.0.0.1", "HASSIO_TOKEN": "abcdefgh"}
|
||||
MOCK_ENVIRON = {"SUPERVISOR": "127.0.0.1", "SUPERVISOR_TOKEN": "abcdefgh"}
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
|
|
|
@ -12,7 +12,7 @@ from homeassistant.setup import async_setup_component
|
|||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
MOCK_ENVIRON = {"HASSIO": "127.0.0.1", "HASSIO_TOKEN": "abcdefgh"}
|
||||
MOCK_ENVIRON = {"SUPERVISOR": "127.0.0.1", "SUPERVISOR_TOKEN": "abcdefgh"}
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue