Skip to content

Commit

Permalink
test(cloud): meijucloud list_home
Browse files Browse the repository at this point in the history
  • Loading branch information
rokam committed May 24, 2024
1 parent 1296f9f commit f842fd0
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/cloud_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,19 @@ async def test_meijucloud_get_keys(self) -> None:
keys: dict = await cloud.get_keys(100)
assert keys.get(1).get("token") == "returnedappliancetoken"
assert keys.get(1).get("key") == "returnedappliancekey"

async def test_meijucloud_list_home(self) -> None:
"""Test MeijuCloud list_home"""
session = Mock()
response = Mock()
response.read = AsyncMock(
return_value=self.responses["meijucloud_list_home.json"]
)
session.request = AsyncMock(return_value=response)
cloud = get_midea_cloud(
"美的美居", session=session, account="account", password="password"
)
homes = await cloud.list_home()
assert len(homes.keys()) == 2
assert homes.get(1) == "Home 1"
assert homes.get(2) == "Home 2"
12 changes: 12 additions & 0 deletions tests/responses/meijucloud_list_home.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"code":0,
"data":{
"homeList":[{
"homegroupId": "1",
"name": "Home 1"
},{
"homegroupId": "2",
"name": "Home 2"
}]
}
}

0 comments on commit f842fd0

Please sign in to comment.