Skip to content

Commit f18f904

Browse files
committed
cf: try to fix step
1 parent 578b318 commit f18f904

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

custom_components/myheat/api.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -129,13 +129,13 @@ def __init__(
129129
*,
130130
username: str,
131131
api_key: str,
132-
device_id: int,
132+
device_id: int | None,
133133
session: aiohttp.ClientSession,
134134
) -> None:
135135
"""Sample API Client."""
136136
self._username: str = username
137137
self._api_key: str = api_key
138-
self._device_id: int = device_id
138+
self._device_id: int | None = device_id
139139
self._session: aiohttp.ClientSession = session
140140

141141
async def async_get_devices(self) -> dict:

custom_components/myheat/config_flow.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,12 @@ async def _get_devices(self, username: str, api_key: str) -> list[Any]:
104104
"""Return true if credentials is valid."""
105105
try:
106106
session = async_create_clientsession(self.hass)
107-
client = MhApiClient(username, api_key, None, session)
107+
client = MhApiClient(
108+
username=username,
109+
api_key=api_key,
110+
device_id=None,
111+
session=session,
112+
)
108113
result = await client.async_get_devices()
109114
return result["devices"]
110115
except Exception: # pylint: disable=broad-except

tests/conftest.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import pytest
66

7-
from .const import MOCK_GET_DEVICE_INFO
7+
from .const import MOCK_GET_DEVICE_INFO, MOCK_GET_DEVICES
88

99

1010
@pytest.fixture(autouse=True)
@@ -29,7 +29,7 @@ def bypass_get_device_info():
2929
"""Skip calls to get data from API."""
3030
with patch(
3131
"custom_components.myheat.MhApiClient.async_get_device_info",
32-
return_value=MOCK_GET_DEVIDE_INFO["data"],
32+
return_value=MOCK_GET_DEVICE_INFO["data"],
3333
):
3434
yield
3535

@@ -39,7 +39,7 @@ def bypass_get_devices():
3939
"""Skip calls to get data from API."""
4040
with patch(
4141
"custom_components.myheat.MhApiClient.async_get_devices",
42-
return_value=MOCK_GET_DEVIDE_INFO["data"],
42+
return_value=MOCK_GET_DEVICES["data"],
4343
):
4444
yield
4545

0 commit comments

Comments
 (0)