Commit dc7a93a
test(e2e): add negative-input tests for ha_get_history and ha_get_automation_traces (homeassistant-ai#945)
* test(e2e): add negative-input tests for ha_get_history and ha_get_automation_traces
Covers three genuinely uncovered paths identified via source-level analysis
and cross-checked against the full test suite (unit + E2E).
ha_get_history — two new cases in workflows/core/test_history.py:
- entity_ids="": single-string branch → entity_id_list=[""] → no pre-flight guard
→ WS call → HA valid_entity_id("")=False → Command failed → INTERNAL_ERROR
- entity_ids=[]: list branch → if-not-entity_id_list → VALIDATION_MISSING_PARAMETER
(no WS call)
ha_get_automation_traces — new file workflows/automation/test_traces_negative.py:
- automation_id="sensor.some_entity": domain-guard (tools_traces.py) rejects
non-automation/script prefix → VALIDATION_INVALID_PARAMETER (no WS call)
No prior hard coverage in unit (57 files) or E2E suite for any of these paths.
Verified: tools_history.py, tools_traces.py, websocket_client.py, helpers.py.
* fix(test): address review feedback on homeassistant-ai#945
- Move ha_get_automation_traces test into existing test_traces.py
- Remove standalone test_traces_negative.py (new file was wrong)
- Remove @pytest.mark.asyncio (asyncio_mode = auto)
- Add type hints: mcp_client: Any, -> None
- Use result directly (no data wrapper on safe_call_tool results)
- Shorten docstrings to one sentence each
* fix(test): sort imports per ruff I001
* fix(test): remove asyncio decorator and shorten docstrings per review
---------
Co-authored-by: Patch76 <patch76@local>
Co-authored-by: Patch76 <patch76@users.noreply.github.com>1 parent 8aa176e commit dc7a93a
2 files changed
Lines changed: 42 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| 16 | + | |
15 | 17 | | |
16 | 18 | | |
17 | 19 | | |
| |||
337 | 339 | | |
338 | 340 | | |
339 | 341 | | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
571 | 572 | | |
572 | 573 | | |
573 | 574 | | |
574 | | - | |
575 | 575 | | |
576 | 576 | | |
577 | 577 | | |
| |||
603 | 603 | | |
604 | 604 | | |
605 | 605 | | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
0 commit comments