Skip to content

Commit 41b4e5a

Browse files
committed
Add tests
1 parent 9a1823a commit 41b4e5a

12 files changed

Lines changed: 510 additions & 54 deletions

tests/cassettes/test_endpoints/test_async_call_service.json

Lines changed: 190 additions & 0 deletions
Large diffs are not rendered by default.

tests/cassettes/test_endpoints/test_call_service.json

Lines changed: 190 additions & 0 deletions
Large diffs are not rendered by default.

tests/test_endpoints.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,17 @@ def test_trigger_service(cached_client: Client) -> None:
499499
logger.info(resp)
500500
assert isinstance(resp, tuple)
501501

502+
def test_call_service(cached_client: Client) -> None:
503+
"""Tests the `POST /api/services/<domain>/<service>` endpoint."""
504+
notify = cached_client.get_domain("notify")
505+
assert notify is not None
506+
resp = notify.persistent_notification(
507+
message="Your API Test Suite just said hello!",
508+
title="Test Suite Notifcation",
509+
)
510+
logger.info(resp)
511+
assert isinstance(resp, tuple)
512+
502513

503514
async def test_async_trigger_service(async_cached_client: AsyncClient) -> None:
504515
"""Tests the `POST /api/services/<domain>/<service>` endpoint."""
@@ -511,6 +522,17 @@ async def test_async_trigger_service(async_cached_client: AsyncClient) -> None:
511522
assert isinstance(resp, tuple)
512523

513524

525+
async def test_async_call_service(async_cached_client: AsyncClient) -> None:
526+
"""Tests the `POST /api/services/<domain>/<service>` endpoint."""
527+
notify = await async_cached_client.get_domain("notify")
528+
assert notify is not None
529+
resp = await notify.persistent_notification(
530+
message="Your API Test Suite just said hello!",
531+
title="Test Suite Notifcation (Async)",
532+
)
533+
assert isinstance(resp, tuple)
534+
535+
514536
def test_websocket_trigger_service(websocket_client: WebsocketClient) -> None:
515537
"""Tests the `"type": "trigger_service"` websocket command."""
516538
notify = websocket_client.get_domain("notify")
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"version": 1,
3+
"minor_version": 2,
4+
"key": "assist_pipeline.pipelines",
5+
"data": {
6+
"items": [
7+
{
8+
"conversation_engine": "conversation.home_assistant",
9+
"conversation_language": "en",
10+
"id": "01kqx2f3wdn8470fjt3x2h3rnv",
11+
"language": "en",
12+
"name": "Home Assistant",
13+
"stt_engine": null,
14+
"stt_language": null,
15+
"tts_engine": null,
16+
"tts_language": null,
17+
"tts_voice": null,
18+
"wake_word_entity": null,
19+
"wake_word_id": null,
20+
"prefer_local_intents": false
21+
}
22+
],
23+
"preferred_item": "01kqx2f3wdn8470fjt3x2h3rnv"
24+
}
25+
}

volumes/config/.storage/auth

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -115,23 +115,6 @@
115115
"credential_id": null,
116116
"version": "2023.3.3"
117117
},
118-
{
119-
"id": "701b4cc2befd4b72ac99a06d7b38181e",
120-
"user_id": "e85fc7b7b8924dc9b024ce90ad23799e",
121-
"client_id": "http://localhost:8123/",
122-
"client_name": null,
123-
"client_icon": null,
124-
"token_type": "normal",
125-
"created_at": "2024-12-20T22:49:28.919077+00:00",
126-
"access_token_expiration": 1800.0,
127-
"token": "783a5dd38b8e987a6dc7263605d2ae9629487fff7a48884e4b83f39983064a49e89474b7ba0d47ec78b76af8c7ab0e5a0ecce3c0d6ec751af62355a8a3611b72",
128-
"jwt_key": "dab8d894766cbdc856cc2475b7f3fd4cb7c1279fbb499a6c1709d5f4264d11842882a28cb3b67259cc983ff7b156781063835d81d76f0356ad0d477d1b09404d",
129-
"last_used_at": "2024-12-20T22:49:28.919136+00:00",
130-
"last_used_ip": "172.18.0.1",
131-
"expire_at": 1742510968.919136,
132-
"credential_id": "711894da0c83415095b3a6314ff20d86",
133-
"version": "2024.12.3"
134-
},
135118
{
136119
"id": "cabbfc0d5e024c2f90b998ffdbea7e61",
137120
"user_id": "6ebcf011775a47c1bc279a1777a1e5a7",

volumes/config/.storage/core.area_registry

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
{
22
"version": 1,
3-
"minor_version": 7,
3+
"minor_version": 9,
44
"key": "core.area_registry",
55
"data": {
66
"areas": [
77
{
8-
"name": "Living Room",
9-
"id": "living_room",
8+
"name": "Bedroom",
9+
"id": "bedroom",
1010
"picture": null,
1111
"aliases": [],
1212
"icon": null,
1313
"floor_id": null,
1414
"labels": [],
1515
"created_at": "1970-01-01T00:00:00+00:00",
16-
"modified_at": "1970-01-01T00:00:00+00:00"
16+
"modified_at": "1970-01-01T00:00:00+00:00",
17+
"humidity_entity_id": null,
18+
"temperature_entity_id": null
1719
},
1820
{
1921
"name": "Kitchen",
@@ -24,18 +26,22 @@
2426
"floor_id": null,
2527
"labels": [],
2628
"created_at": "1970-01-01T00:00:00+00:00",
27-
"modified_at": "1970-01-01T00:00:00+00:00"
29+
"modified_at": "1970-01-01T00:00:00+00:00",
30+
"humidity_entity_id": null,
31+
"temperature_entity_id": null
2832
},
2933
{
30-
"name": "Bedroom",
31-
"id": "bedroom",
34+
"name": "Living Room",
35+
"id": "living_room",
3236
"picture": null,
3337
"aliases": [],
3438
"icon": null,
3539
"floor_id": null,
3640
"labels": [],
3741
"created_at": "1970-01-01T00:00:00+00:00",
38-
"modified_at": "1970-01-01T00:00:00+00:00"
42+
"modified_at": "1970-01-01T00:00:00+00:00",
43+
"humidity_entity_id": null,
44+
"temperature_entity_id": null
3945
}
4046
]
4147
}
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
{
22
"version": 1,
3-
"minor_version": 4,
3+
"minor_version": 5,
44
"key": "core.config_entries",
55
"data": {
66
"entries": [
7-
{"created_at":"1970-01-01T00:00:00+00:00","data":{},"disabled_by":null,"discovery_keys":{},"domain":"sun","entry_id":"5f8426fa502435857743f302651753c9","minor_version":1,"modified_at":"1970-01-01T00:00:00+00:00","options":{},"pref_disable_new_entities":false,"pref_disable_polling":false,"source":"import","title":"Sun","unique_id":null,"version":1},
8-
{"created_at":"1970-01-01T00:00:00+00:00","data":{},"disabled_by":null,"discovery_keys":{},"domain":"radio_browser","entry_id":"bb18b688994e8cfa5e4e880452735628","minor_version":1,"modified_at":"1970-01-01T00:00:00+00:00","options":{},"pref_disable_new_entities":false,"pref_disable_polling":false,"source":"onboarding","title":"Radio Browser","unique_id":null,"version":1},
9-
{"created_at":"2024-12-20T17:06:07.193748+00:00","data":{"elevation":1000.0,"latitude":52.3731339,"longitude":4.8903147,"name":"Home"},"disabled_by":null,"discovery_keys":{},"domain":"met","entry_id":"01JFJGH76SD417XC4YJTG8QJWB","minor_version":1,"modified_at":"2024-12-20T17:06:07.193752+00:00","options":{},"pref_disable_new_entities":false,"pref_disable_polling":false,"source":"user","title":"Home","unique_id":null,"version":1}
7+
{"created_at":"1970-01-01T00:00:00+00:00","data":{},"disabled_by":null,"discovery_keys":{},"domain":"sun","entry_id":"5f8426fa502435857743f302651753c9","minor_version":1,"modified_at":"1970-01-01T00:00:00+00:00","options":{},"pref_disable_new_entities":false,"pref_disable_polling":false,"source":"import","subentries":[],"title":"Sun","unique_id":null,"version":1},
8+
{"created_at":"1970-01-01T00:00:00+00:00","data":{},"disabled_by":null,"discovery_keys":{},"domain":"radio_browser","entry_id":"bb18b688994e8cfa5e4e880452735628","minor_version":1,"modified_at":"1970-01-01T00:00:00+00:00","options":{},"pref_disable_new_entities":false,"pref_disable_polling":false,"source":"onboarding","subentries":[],"title":"Radio Browser","unique_id":null,"version":1},
9+
{"created_at":"2024-12-20T17:06:07.193748+00:00","data":{"elevation":1000.0,"latitude":52.3731339,"longitude":4.8903147,"name":"Home"},"disabled_by":null,"discovery_keys":{},"domain":"met","entry_id":"01JFJGH76SD417XC4YJTG8QJWB","minor_version":1,"modified_at":"2024-12-20T17:06:07.193752+00:00","options":{},"pref_disable_new_entities":false,"pref_disable_polling":false,"source":"user","subentries":[],"title":"Home","unique_id":null,"version":1},
10+
{"created_at":"2026-05-05T21:59:50.097244+00:00","data":{},"disabled_by":null,"discovery_keys":{},"domain":"backup","entry_id":"01KQX2F42HV8K233Y5J1SWW275","minor_version":1,"modified_at":"2026-05-05T21:59:50.097246+00:00","options":{},"pref_disable_new_entities":false,"pref_disable_polling":false,"source":"system","subentries":[],"title":"Backup","unique_id":null,"version":1}
1011
]
1112
}
1213
}

volumes/config/.storage/core.device_registry

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
{
22
"version": 1,
3-
"minor_version": 8,
3+
"minor_version": 12,
44
"key": "core.device_registry",
55
"data": {
66
"devices": [
7-
{"area_id":null,"config_entries":["5f8426fa502435857743f302651753c9"],"configuration_url":null,"connections":[],"created_at":"2024-12-17T01:58:48.779854+00:00","disabled_by":null,"entry_type":"service","hw_version":null,"id":"b3d3fadee11d077d99d948c173631abc","identifiers":[["sun","5f8426fa502435857743f302651753c9"]],"labels":[],"manufacturer":null,"model":null,"model_id":null,"modified_at":"2024-12-17T01:58:48.779886+00:00","name_by_user":null,"name":"Sun","primary_config_entry":"5f8426fa502435857743f302651753c9","serial_number":null,"sw_version":null,"via_device_id":null},
8-
{"area_id":null,"config_entries":["01JFJGH76SD417XC4YJTG8QJWB"],"configuration_url":"https://www.met.no/en","connections":[],"created_at":"2024-12-20T17:06:07.780759+00:00","disabled_by":null,"entry_type":"service","hw_version":null,"id":"6586dbdeb10a88ae4603b47e600c6124","identifiers":[["met","01JFJGH76SD417XC4YJTG8QJWB"]],"labels":[],"manufacturer":"Met.no","model":"Forecast","model_id":null,"modified_at":"2024-12-20T17:06:07.780798+00:00","name_by_user":null,"name":"Forecast","primary_config_entry":"01JFJGH76SD417XC4YJTG8QJWB","serial_number":null,"sw_version":null,"via_device_id":null}
7+
{"area_id":null,"config_entries":["5f8426fa502435857743f302651753c9"],"config_entries_subentries":{"5f8426fa502435857743f302651753c9":[null]},"configuration_url":null,"connections":[],"created_at":"2024-12-17T01:58:48.779854+00:00","disabled_by":null,"entry_type":"service","hw_version":null,"id":"b3d3fadee11d077d99d948c173631abc","identifiers":[["sun","5f8426fa502435857743f302651753c9"]],"labels":[],"manufacturer":null,"model":null,"model_id":null,"modified_at":"2024-12-17T01:58:48.779886+00:00","name_by_user":null,"name":"Sun","primary_config_entry":"5f8426fa502435857743f302651753c9","serial_number":null,"sw_version":null,"via_device_id":null},
8+
{"area_id":null,"config_entries":["01JFJGH76SD417XC4YJTG8QJWB"],"config_entries_subentries":{"01JFJGH76SD417XC4YJTG8QJWB":[null]},"configuration_url":"https://www.met.no/en","connections":[],"created_at":"2024-12-20T17:06:07.780759+00:00","disabled_by":null,"entry_type":"service","hw_version":null,"id":"6586dbdeb10a88ae4603b47e600c6124","identifiers":[["met","01JFJGH76SD417XC4YJTG8QJWB"]],"labels":[],"manufacturer":"Met.no","model":"Forecast","model_id":null,"modified_at":"2024-12-20T17:06:07.780798+00:00","name_by_user":null,"name":"Forecast","primary_config_entry":"01JFJGH76SD417XC4YJTG8QJWB","serial_number":null,"sw_version":null,"via_device_id":null},
9+
{"area_id":null,"config_entries":["01KQX2F42HV8K233Y5J1SWW275"],"config_entries_subentries":{"01KQX2F42HV8K233Y5J1SWW275":[null]},"configuration_url":"homeassistant://config/backup","connections":[],"created_at":"2026-05-05T21:59:50.101985+00:00","disabled_by":null,"entry_type":"service","hw_version":null,"id":"f538a7d37354c6926bc94d9cfb8b8ea3","identifiers":[["backup","backup_manager"]],"labels":[],"manufacturer":"Home Assistant","model":"Home Assistant Backup","model_id":null,"modified_at":"2026-05-05T21:59:50.102034+00:00","name_by_user":null,"name":"Backup","primary_config_entry":"01KQX2F42HV8K233Y5J1SWW275","serial_number":null,"sw_version":"2026.4.4","via_device_id":null}
910
],
1011
"deleted_devices": []
1112
}

0 commit comments

Comments
 (0)