Skip to content
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
4 changes: 2 additions & 2 deletions tests/components/miele/test_button.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Tests for Miele button module."""

from unittest.mock import MagicMock
from unittest.mock import MagicMock, Mock

from aiohttp import ClientResponseError
import pytest
Expand Down Expand Up @@ -70,7 +70,7 @@ async def test_api_failure(
setup_platform: MockConfigEntry,
) -> None:
"""Test handling of exception from API."""
mock_miele_client.send_action.side_effect = ClientResponseError("test", "Test")
mock_miele_client.send_action.side_effect = ClientResponseError(Mock(), Mock())

with pytest.raises(
HomeAssistantError, match=f"Failed to set state for {ENTITY_ID}"
Expand Down
4 changes: 2 additions & 2 deletions tests/components/miele/test_climate.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Tests for miele climate module."""

from unittest.mock import MagicMock
from unittest.mock import MagicMock, Mock

from aiohttp import ClientResponseError
import pytest
Expand Down Expand Up @@ -108,7 +108,7 @@ async def test_api_failure(
) -> None:
"""Test handling of exception from API."""
mock_miele_client.set_target_temperature.side_effect = ClientResponseError(
"test", "Test"
Mock(), Mock()
)

with pytest.raises(
Expand Down
6 changes: 3 additions & 3 deletions tests/components/miele/test_fan.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Tests for miele fan module."""

from typing import Any
from unittest.mock import MagicMock
from unittest.mock import MagicMock, Mock

from aiohttp import ClientResponseError
import pytest
Expand Down Expand Up @@ -141,7 +141,7 @@ async def test_api_failure(
service: str,
) -> None:
"""Test handling of exception from API."""
mock_miele_client.send_action.side_effect = ClientResponseError("test", "Test")
mock_miele_client.send_action.side_effect = ClientResponseError(Mock(), Mock())

with pytest.raises(HomeAssistantError):
await hass.services.async_call(
Expand All @@ -156,7 +156,7 @@ async def test_set_percentage(
setup_platform: None,
) -> None:
"""Test handling of exception at set_percentage."""
mock_miele_client.send_action.side_effect = ClientResponseError("test", "Test")
mock_miele_client.send_action.side_effect = ClientResponseError(Mock(), Mock())

with pytest.raises(
HomeAssistantError, match=f"Failed to set state for {ENTITY_ID}"
Expand Down
4 changes: 2 additions & 2 deletions tests/components/miele/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from datetime import timedelta
import http
import time
from unittest.mock import MagicMock, patch
from unittest.mock import MagicMock, Mock, patch

from aiohttp import ClientConnectionError, ClientResponseError
from freezegun.api import FrozenDateTimeFactory
Expand Down Expand Up @@ -215,7 +215,7 @@ async def test_setup_all_platforms(
@pytest.mark.parametrize(
"side_effect",
[
ClientResponseError("test", "Test"),
ClientResponseError(Mock(), Mock()),
TimeoutError,
],
ids=[
Expand Down
4 changes: 2 additions & 2 deletions tests/components/miele/test_light.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Tests for miele light module."""

from unittest.mock import MagicMock
from unittest.mock import MagicMock, Mock

from aiohttp import ClientResponseError
import pytest
Expand Down Expand Up @@ -84,7 +84,7 @@ async def test_api_failure(
service: str,
) -> None:
"""Test handling of exception from API."""
mock_miele_client.send_action.side_effect = ClientResponseError("test", "Test")
mock_miele_client.send_action.side_effect = ClientResponseError(Mock(), Mock())

with pytest.raises(
HomeAssistantError, match=f"Failed to set state for {ENTITY_ID}"
Expand Down
6 changes: 3 additions & 3 deletions tests/components/miele/test_services.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Tests the services provided by the miele integration."""

from datetime import timedelta
from unittest.mock import MagicMock
from unittest.mock import MagicMock, Mock

from aiohttp import ClientResponseError
import pytest
Expand Down Expand Up @@ -138,7 +138,7 @@ async def test_service_api_errors(
device = device_registry.async_get_device(identifiers={(DOMAIN, TEST_APPLIANCE)})

# Test http error
mock_miele_client.set_program.side_effect = ClientResponseError("TestInfo", "test")
mock_miele_client.set_program.side_effect = ClientResponseError(Mock(), Mock())
with pytest.raises(HomeAssistantError, match=error):
await hass.services.async_call(
DOMAIN,
Expand All @@ -162,7 +162,7 @@ async def test_get_service_api_errors(
device = device_registry.async_get_device(identifiers={(DOMAIN, TEST_APPLIANCE)})

# Test http error
mock_miele_client.get_programs.side_effect = ClientResponseError("TestInfo", "test")
mock_miele_client.get_programs.side_effect = ClientResponseError(Mock(), Mock())
with pytest.raises(HomeAssistantError, match="'Get programs' action failed"):
await hass.services.async_call(
DOMAIN,
Expand Down
4 changes: 2 additions & 2 deletions tests/components/miele/test_switch.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Tests for miele switch module."""

from unittest.mock import MagicMock
from unittest.mock import MagicMock, Mock

from aiohttp import ClientResponseError
import pytest
Expand Down Expand Up @@ -99,7 +99,7 @@ async def test_api_failure(
entity: str,
) -> None:
"""Test handling of exception from API."""
mock_miele_client.send_action.side_effect = ClientResponseError("test", "Test")
mock_miele_client.send_action.side_effect = ClientResponseError(Mock(), Mock())

with pytest.raises(HomeAssistantError, match=f"Failed to set state for {entity}"):
await hass.services.async_call(
Expand Down
4 changes: 2 additions & 2 deletions tests/components/miele/test_vacuum.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Tests for miele vacuum module."""

from unittest.mock import MagicMock
from unittest.mock import MagicMock, Mock

from aiohttp import ClientResponseError
from pymiele import MieleDevices
Expand Down Expand Up @@ -142,7 +142,7 @@ async def test_api_failure(
service: str,
) -> None:
"""Test handling of exception from API."""
mock_miele_client.send_action.side_effect = ClientResponseError("test", "Test")
mock_miele_client.send_action.side_effect = ClientResponseError(Mock(), Mock())

with pytest.raises(
HomeAssistantError, match=f"Failed to set state for {ENTITY_ID}"
Expand Down
Loading