Skip to content

Commit

Permalink
Fix unifiprotect tests for ruff B018 (home-assistant#113584)
Browse files Browse the repository at this point in the history
  • Loading branch information
autinerd authored Mar 16, 2024
1 parent eb90c9a commit dd3101e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
1 change: 0 additions & 1 deletion tests/components/unifiprotect/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ async def test_setup_multiple(
nvr = bootstrap.nvr
nvr._api = ufp.api
nvr.mac = "A1E00C826983"
nvr.id
ufp.api.get_nvr = AsyncMock(return_value=nvr)

with patch(
Expand Down
18 changes: 9 additions & 9 deletions tests/components/unifiprotect/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ async def test_thumbnail_bad_nvr_id(
response = cast(ClientResponse, await http_client.get(url))

assert response.status == 404
ufp.api.get_event_thumbnail.assert_not_called
ufp.api.get_event_thumbnail.assert_not_called()


@pytest.mark.parametrize(("width", "height"), [("test", None), (None, "test")])
Expand All @@ -62,7 +62,7 @@ async def test_thumbnail_bad_params(
response = cast(ClientResponse, await http_client.get(url))

assert response.status == 400
ufp.api.get_event_thumbnail.assert_not_called
ufp.api.get_event_thumbnail.assert_not_called()


async def test_thumbnail_bad_event(
Expand Down Expand Up @@ -259,7 +259,7 @@ async def test_video_bad_nvr_id(
response = cast(ClientResponse, await http_client.get(url))

assert response.status == 404
ufp.api.request.assert_not_called
ufp.api.request.assert_not_called()


async def test_video_bad_camera_id(
Expand Down Expand Up @@ -293,7 +293,7 @@ async def test_video_bad_camera_id(
response = cast(ClientResponse, await http_client.get(url))

assert response.status == 404
ufp.api.request.assert_not_called
ufp.api.request.assert_not_called()


async def test_video_bad_camera_perms(
Expand Down Expand Up @@ -329,7 +329,7 @@ async def test_video_bad_camera_perms(
response = cast(ClientResponse, await http_client.get(url))

assert response.status == 403
ufp.api.request.assert_not_called
ufp.api.request.assert_not_called()


@pytest.mark.parametrize(("start", "end"), [("test", None), (None, "test")])
Expand Down Expand Up @@ -369,7 +369,7 @@ async def test_video_bad_params(
response = cast(ClientResponse, await http_client.get(url))

assert response.status == 400
ufp.api.request.assert_not_called
ufp.api.request.assert_not_called()


async def test_video_bad_video(
Expand Down Expand Up @@ -403,7 +403,7 @@ async def test_video_bad_video(
response = cast(ClientResponse, await http_client.get(url))

assert response.status == 404
ufp.api.request.assert_called_once
ufp.api.request.assert_called_once()


async def test_video(
Expand Down Expand Up @@ -446,7 +446,7 @@ async def test_video(
assert await response.content.read() == b"testtest"

assert response.status == 200
ufp.api.request.assert_called_once
ufp.api.request.assert_called_once()


async def test_video_entity_id(
Expand Down Expand Up @@ -490,4 +490,4 @@ async def test_video_entity_id(
assert await response.content.read() == b"testtest"

assert response.status == 200
ufp.api.request.assert_called_once
ufp.api.request.assert_called_once()

0 comments on commit dd3101e

Please sign in to comment.