Skip to content

Commit 51661f6

Browse files
committed
Fix is_connected mocks in other tests
1 parent 22c57d4 commit 51661f6

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

tests/components/http/test_ban.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from http import HTTPStatus
44
from ipaddress import ip_address
55
import os
6-
from unittest.mock import Mock, mock_open, patch
6+
from unittest.mock import AsyncMock, Mock, mock_open, patch
77

88
from aiohttp import web
99
from aiohttp.web_exceptions import HTTPUnauthorized
@@ -34,14 +34,10 @@
3434

3535

3636
@pytest.fixture(name="hassio_env")
37-
def hassio_env_fixture():
37+
def hassio_env_fixture(supervisor_is_connected: AsyncMock):
3838
"""Fixture to inject hassio env."""
3939
with (
4040
patch.dict(os.environ, {"SUPERVISOR": "127.0.0.1"}),
41-
patch(
42-
"homeassistant.components.hassio.HassIO.is_connected",
43-
return_value={"result": "ok", "data": {}},
44-
),
4541
patch.dict(os.environ, {"SUPERVISOR_TOKEN": "123456"}),
4642
):
4743
yield

tests/components/onboarding/test_views.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from http import HTTPStatus
66
import os
77
from typing import Any
8-
from unittest.mock import Mock, patch
8+
from unittest.mock import AsyncMock, Mock, patch
99

1010
import pytest
1111

@@ -69,7 +69,9 @@ async def no_rpi_fixture(
6969

7070
@pytest.fixture(name="mock_supervisor")
7171
async def mock_supervisor_fixture(
72-
aioclient_mock: AiohttpClientMocker, store_info
72+
aioclient_mock: AiohttpClientMocker,
73+
store_info: AsyncMock,
74+
supervisor_is_connected: AsyncMock,
7375
) -> AsyncGenerator[None]:
7476
"""Mock supervisor."""
7577
aioclient_mock.post("http://127.0.0.1/homeassistant/options", json={"result": "ok"})
@@ -99,10 +101,6 @@ async def mock_supervisor_fixture(
99101
)
100102
with (
101103
patch.dict(os.environ, {"SUPERVISOR": "127.0.0.1"}),
102-
patch(
103-
"homeassistant.components.hassio.HassIO.is_connected",
104-
return_value=True,
105-
),
106104
patch(
107105
"homeassistant.components.hassio.HassIO.get_info",
108106
return_value={},

0 commit comments

Comments
 (0)