Skip to content

Commit 8968cf7

Browse files
authored
Use send_json_auto_id in KNX tests (home-assistant#147982)
1 parent ebe0446 commit 8968cf7

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

tests/components/knx/test_websocket.py

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ async def test_knx_info_command(
2222
"""Test knx/info command."""
2323
await knx.setup_integration()
2424
client = await hass_ws_client(hass)
25-
await client.send_json({"id": 6, "type": "knx/info"})
25+
await client.send_json_auto_id({"type": "knx/info"})
2626

2727
res = await client.receive_json()
2828
assert res["success"], res
@@ -41,7 +41,7 @@ async def test_knx_info_command_with_project(
4141
"""Test knx/info command with loaded project."""
4242
await knx.setup_integration()
4343
client = await hass_ws_client(hass)
44-
await client.send_json({"id": 6, "type": "knx/info"})
44+
await client.send_json_auto_id({"type": "knx/info"})
4545

4646
res = await client.receive_json()
4747
assert res["success"], res
@@ -69,9 +69,8 @@ async def test_knx_project_file_process(
6969
client = await hass_ws_client(hass)
7070
assert not hass.data[KNX_MODULE_KEY].project.loaded
7171

72-
await client.send_json(
72+
await client.send_json_auto_id(
7373
{
74-
"id": 6,
7574
"type": "knx/project_file_process",
7675
"file_id": _file_id,
7776
"password": _password,
@@ -104,9 +103,8 @@ async def test_knx_project_file_process_error(
104103
client = await hass_ws_client(hass)
105104
assert not hass.data[KNX_MODULE_KEY].project.loaded
106105

107-
await client.send_json(
106+
await client.send_json_auto_id(
108107
{
109-
"id": 6,
110108
"type": "knx/project_file_process",
111109
"file_id": "1234",
112110
"password": "",
@@ -139,7 +137,7 @@ async def test_knx_project_file_remove(
139137
client = await hass_ws_client(hass)
140138
assert hass.data[KNX_MODULE_KEY].project.loaded
141139

142-
await client.send_json({"id": 6, "type": "knx/project_file_remove"})
140+
await client.send_json_auto_id({"type": "knx/project_file_remove"})
143141
res = await client.receive_json()
144142

145143
assert res["success"], res
@@ -158,7 +156,7 @@ async def test_knx_get_project(
158156
client = await hass_ws_client(hass)
159157
assert hass.data[KNX_MODULE_KEY].project.loaded
160158

161-
await client.send_json({"id": 3, "type": "knx/get_knx_project"})
159+
await client.send_json_auto_id({"type": "knx/get_knx_project"})
162160
res = await client.receive_json()
163161
assert res["success"], res
164162
assert res["result"]["project_loaded"] is True
@@ -172,7 +170,7 @@ async def test_knx_group_monitor_info_command(
172170
await knx.setup_integration()
173171
client = await hass_ws_client(hass)
174172

175-
await client.send_json({"id": 6, "type": "knx/group_monitor_info"})
173+
await client.send_json_auto_id({"type": "knx/group_monitor_info"})
176174

177175
res = await client.receive_json()
178176
assert res["success"], res
@@ -234,7 +232,7 @@ async def test_knx_subscribe_telegrams_command_recent_telegrams(
234232

235233
# connect websocket after telegrams have been sent
236234
client = await hass_ws_client(hass)
237-
await client.send_json({"id": 6, "type": "knx/group_monitor_info"})
235+
await client.send_json_auto_id({"type": "knx/group_monitor_info"})
238236
res = await client.receive_json()
239237
assert res["success"], res
240238
assert res["result"]["project_loaded"] is False
@@ -272,7 +270,7 @@ async def test_knx_subscribe_telegrams_command_no_project(
272270
}
273271
)
274272
client = await hass_ws_client(hass)
275-
await client.send_json({"id": 6, "type": "knx/subscribe_telegrams"})
273+
await client.send_json_auto_id({"type": "knx/subscribe_telegrams"})
276274
res = await client.receive_json()
277275
assert res["success"], res
278276

@@ -340,7 +338,7 @@ async def test_knx_subscribe_telegrams_command_project(
340338
"""Test knx/subscribe_telegrams command with project data."""
341339
await knx.setup_integration()
342340
client = await hass_ws_client(hass)
343-
await client.send_json({"id": 6, "type": "knx/subscribe_telegrams"})
341+
await client.send_json_auto_id({"type": "knx/subscribe_telegrams"})
344342
res = await client.receive_json()
345343
assert res["success"], res
346344

0 commit comments

Comments
 (0)