Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add version to upload details request #614

Merged
merged 1 commit into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions hass_nabucasa/cloud_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ async def async_files_upload_details(
filename: str,
base64md5hash: str,
size: int,
homeassistant_version: str | None = None,
) -> dict[str, Any]:
"""Get files upload details."""
resp = await cloud.websession.get(
Expand All @@ -171,6 +172,7 @@ async def async_files_upload_details(
json={
"storage_type": storage_type,
"filename": filename,
"homeassistant_version": homeassistant_version,
"md5": base64md5hash,
"size": size,
},
Expand Down
3 changes: 3 additions & 0 deletions tests/test_cloud_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,13 +207,15 @@ async def test_async_files_upload_detils(
filename="test.txt",
base64md5hash=base64md5hash,
size=2,
homeassistant_version="1970.1.1",
)

assert len(aioclient_mock.mock_calls) == 1
# 2 is the body
assert aioclient_mock.mock_calls[0][2] == {
"filename": "test.txt",
"storage_type": "test",
"homeassistant_version": "1970.1.1",
"md5": base64md5hash,
"size": 2,
}
Expand Down Expand Up @@ -255,6 +257,7 @@ async def test_async_files_upload_details_error(
assert aioclient_mock.mock_calls[0][2] == {
"filename": "test.txt",
"storage_type": "test",
"homeassistant_version": None,
"md5": base64md5hash,
"size": 2,
}
Expand Down