Bump python-matter-server to 3.0.0 (#88607)
* Bump python-matter-server to 3.0.0 Include all fixes for the changed api schema of the library * fix test fixtures * remove invalid data from fixtures * fix some of the tests * fix binary sensor bug * fix sensor bug * fix switch test * fix tests * adjust bugs and typos
This commit is contained in:
parent
9c7adfc4b2
commit
881e85d74f
39 changed files with 3687 additions and 31021 deletions
|
@ -3,7 +3,7 @@ from collections.abc import Awaitable, Callable
|
|||
from unittest.mock import MagicMock, call
|
||||
|
||||
from aiohttp import ClientWebSocketResponse
|
||||
from matter_server.client.exceptions import FailedCommand
|
||||
from matter_server.common.errors import InvalidCommand, NodeCommissionFailed
|
||||
|
||||
from homeassistant.components.matter.api import ID, TYPE
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
@ -33,8 +33,8 @@ async def test_commission(
|
|||
matter_client.commission_with_code.assert_called_once_with("12345678")
|
||||
|
||||
matter_client.commission_with_code.reset_mock()
|
||||
matter_client.commission_with_code.side_effect = FailedCommand(
|
||||
"test_id", "test_code", "Failed to commission"
|
||||
matter_client.commission_with_code.side_effect = InvalidCommand(
|
||||
"test_id", "9", "Failed to commission"
|
||||
)
|
||||
|
||||
await ws_client.send_json(
|
||||
|
@ -47,7 +47,7 @@ async def test_commission(
|
|||
msg = await ws_client.receive_json()
|
||||
|
||||
assert not msg["success"]
|
||||
assert msg["error"]["code"] == "test_code"
|
||||
assert msg["error"]["code"] == "9"
|
||||
matter_client.commission_with_code.assert_called_once_with("12345678")
|
||||
|
||||
|
||||
|
@ -73,8 +73,8 @@ async def test_commission_on_network(
|
|||
matter_client.commission_on_network.assert_called_once_with(1234)
|
||||
|
||||
matter_client.commission_on_network.reset_mock()
|
||||
matter_client.commission_on_network.side_effect = FailedCommand(
|
||||
"test_id", "test_code", "Failed to commission on network"
|
||||
matter_client.commission_on_network.side_effect = NodeCommissionFailed(
|
||||
"test_id", "1", "Failed to commission on network"
|
||||
)
|
||||
|
||||
await ws_client.send_json(
|
||||
|
@ -87,7 +87,7 @@ async def test_commission_on_network(
|
|||
msg = await ws_client.receive_json()
|
||||
|
||||
assert not msg["success"]
|
||||
assert msg["error"]["code"] == "test_code"
|
||||
assert msg["error"]["code"] == "1"
|
||||
matter_client.commission_on_network.assert_called_once_with(1234)
|
||||
|
||||
|
||||
|
@ -113,8 +113,8 @@ async def test_set_thread_dataset(
|
|||
matter_client.set_thread_operational_dataset.assert_called_once_with("test_dataset")
|
||||
|
||||
matter_client.set_thread_operational_dataset.reset_mock()
|
||||
matter_client.set_thread_operational_dataset.side_effect = FailedCommand(
|
||||
"test_id", "test_code", "Failed to commission"
|
||||
matter_client.set_thread_operational_dataset.side_effect = NodeCommissionFailed(
|
||||
"test_id", "1", "Failed to commission"
|
||||
)
|
||||
|
||||
await ws_client.send_json(
|
||||
|
@ -127,7 +127,7 @@ async def test_set_thread_dataset(
|
|||
msg = await ws_client.receive_json()
|
||||
|
||||
assert not msg["success"]
|
||||
assert msg["error"]["code"] == "test_code"
|
||||
assert msg["error"]["code"] == "1"
|
||||
matter_client.set_thread_operational_dataset.assert_called_once_with("test_dataset")
|
||||
|
||||
|
||||
|
@ -157,8 +157,8 @@ async def test_set_wifi_credentials(
|
|||
)
|
||||
|
||||
matter_client.set_wifi_credentials.reset_mock()
|
||||
matter_client.set_wifi_credentials.side_effect = FailedCommand(
|
||||
"test_id", "test_code", "Failed to commission on network"
|
||||
matter_client.set_wifi_credentials.side_effect = NodeCommissionFailed(
|
||||
"test_id", "1", "Failed to commission on network"
|
||||
)
|
||||
|
||||
await ws_client.send_json(
|
||||
|
@ -172,7 +172,7 @@ async def test_set_wifi_credentials(
|
|||
msg = await ws_client.receive_json()
|
||||
|
||||
assert not msg["success"]
|
||||
assert msg["error"]["code"] == "test_code"
|
||||
assert msg["error"]["code"] == "1"
|
||||
assert matter_client.set_wifi_credentials.call_count == 1
|
||||
assert matter_client.set_wifi_credentials.call_args == call(
|
||||
ssid="test_network", credentials="test_password"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue