File tree Expand file tree Collapse file tree 2 files changed +6
-12
lines changed Expand file tree Collapse file tree 2 files changed +6
-12
lines changed Original file line number Diff line number Diff line change 33from http import HTTPStatus
44from ipaddress import ip_address
55import os
6- from unittest .mock import Mock , mock_open , patch
6+ from unittest .mock import AsyncMock , Mock , mock_open , patch
77
88from aiohttp import web
99from aiohttp .web_exceptions import HTTPUnauthorized
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
Original file line number Diff line number Diff line change 55from http import HTTPStatus
66import os
77from typing import Any
8- from unittest .mock import Mock , patch
8+ from unittest .mock import AsyncMock , Mock , patch
99
1010import pytest
1111
@@ -69,7 +69,9 @@ async def no_rpi_fixture(
6969
7070@pytest .fixture (name = "mock_supervisor" )
7171async 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 = {},
You can’t perform that action at this time.
0 commit comments