Skip to content

Commit

Permalink
Merge pull request #41 from peribeir/dev
Browse files Browse the repository at this point in the history
Fix
  • Loading branch information
peribeir authored Jun 10, 2023
2 parents e992206 + 6592977 commit 0f19169
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion homepilot/hub.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ async def get_hub_macaddress(api):
@staticmethod
async def async_build_from_api(api: HomePilotApi, did):
fw_version = await api.async_get_fw_version()
mac_address = await self.get_hub_macaddress(api)
mac_address = await HomePilotHub.get_hub_macaddress(api)
nodename: str = (await api.async_get_nodename())["nodename"]
capabilities_map = HomePilotDevice.get_capabilities_map(
HomePilotHub.get_capabilities()
Expand Down
16 changes: 15 additions & 1 deletion tests/test_hub.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,20 @@ def mocked_api(self, event_loop):
"df_stick_version": "2.0"
})
api.async_get_fw_version.return_value = func_get_fw_version
func_get_interfaces = asyncio.Future(loop=event_loop)
func_get_interfaces.set_result({
"interfaces": {
"eth0": {
"address": "b0:1f:81:b1:21:7a",
"carrier": "1",
"speed": "100",
"type": "ethernet",
"duplex": "full",
"enabled": True
}
}
})
api.async_get_interfaces.return_value = func_get_interfaces
func_get_nodename = asyncio.Future(loop=event_loop)
func_get_nodename.set_result({"nodename": "testnodename"})
api.async_get_nodename.return_value = func_get_nodename
Expand All @@ -39,7 +53,7 @@ async def test_build_from_api(self, mocked_api):
hub = await HomePilotHub.async_build_from_api(mocked_api, "-1")
assert hub.api == mocked_api
assert hub.did == "-1"
assert hub.uid == TEST_HOST
assert hub.uid == "b01f81b1217a"
assert hub.device_number == "-1"
assert hub.device_group == "-1"
assert hub.duofern_stick_version == "2.0"
Expand Down

0 comments on commit 0f19169

Please sign in to comment.