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

Fix Set Setting URL in the Python SDK #402

Merged
merged 5 commits into from
Sep 21, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Unreleased
----------
* Fix BLE notifications not being routed correctly
* Don't hardcode media directory. Also append directory to filenames in media list.
* Fix malformed Set Setting HTTP url

0.14.0 (September-13-2022)
--------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -991,9 +991,9 @@ async def set(self, value: ValueType) -> GoProResp:
Returns:
GoProResp: Status of set
"""
value = value.value if isinstance(value, enum.Enum) else value
url = self._endpoint.format(int(self._identifier), value)
logger.info(Logger.build_log_tx_str(pretty_print(self._as_dict(value=value, endpoint=url))))
value = value.value if isinstance(value, enum.Enum) else value
# Send to camera
if response := await self._communicator._http_get(
url,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import pytest

from open_gopro import Params
from open_gopro.gopro_base import GoProBase

camera_file = "100GOPRO/XXX.mp4"
Expand All @@ -18,6 +19,12 @@ async def test_get_with_no_params(mock_wifi_communicator: GoProBase):
assert response.url == "gopro/media/list"


@pytest.mark.asyncio
async def test_set_setting(mock_wifi_communicator: GoProBase):
response = await mock_wifi_communicator.http_setting.fps.set(Params.FPS.FPS_100)
assert response.url == "gopro/camera/setting?setting=3&option=2"


@pytest.mark.asyncio
async def test_get_with_params(mock_wifi_communicator: GoProBase):
zoom = 99
Expand Down
Loading