Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Dec 2, 2024
1 parent 711f384 commit 4c2b85f
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,12 @@ async def test_update_failure(api):
async def test_light_toggle_success(api):
api._userid = "123" # Simulate successful login
api._data = {"AA:BB:CC:DD:EE:FF-1": {"chooseGarden": 0, "lightTemp": 1}}
with patch(
"custom_components.aerogarden.api.AerogardenAPI._post_request"
) as mock_post, patch(
"custom_components.aerogarden.api.AerogardenAPI.update"
) as mock_update:
with (
patch(
"custom_components.aerogarden.api.AerogardenAPI._post_request"
) as mock_post,
patch("custom_components.aerogarden.api.AerogardenAPI.update") as mock_update,
):
mock_post.return_value = {"code": 1}
mock_update.return_value = True
result = await api.light_toggle("AA:BB:CC:DD:EE:FF-1")
Expand Down Expand Up @@ -119,10 +120,11 @@ def test_garden_property(api):
@pytest.mark.asyncio
async def test_update_throttle(api):
api._userid = "123" # Simulate successful login
with patch(
"custom_components.aerogarden.api.AerogardenAPI._post_request"
) as mock_post, patch(
"custom_components.aerogarden.api.MIN_TIME_BETWEEN_UPDATES", new=1
with (
patch(
"custom_components.aerogarden.api.AerogardenAPI._post_request"
) as mock_post,
patch("custom_components.aerogarden.api.MIN_TIME_BETWEEN_UPDATES", new=1),
):
mock_post.return_value = [{"airGuid": "AA:BB:CC:DD:EE:FF", "configID": 1}]

Expand Down

0 comments on commit 4c2b85f

Please sign in to comment.