Commit 3cb4fd7
test(tools_integrations): pin negative paths of 404-narrow + Path 4 non-not_found
Three new unit tests defend the idempotent contract's narrow against
future regression:
1. test_simple_path_404_on_state_check_routes_to_already_deleted —
pins the positive case of the Path 1 fallback-2 fix from 781e083:
get_entity_state raises HomeAssistantAPIError(status_code=404) →
classified as state_gone → registry-verify confirms absent →
idempotent already_deleted return. Without this test, a future
refactor that removes the 404 branch could silently break the
never-existed-target idempotent contract.
2. test_simple_path_non_404_apierror_propagates — pins the negative
case of the same narrow: HomeAssistantAPIError(status_code=500)
on the state-check must propagate via the outer exception chain,
NOT silently classify as state_gone. Defends against a regression
that drops the ``if e.status_code != 404: raise`` guard.
3. test_remove_helpers_integrations_subentry_other_error_surfaces_service_call_failed —
pins the Path 4 negative case: an HA error response with a code
other than "not_found" (e.g. "permission_denied") must raise
SERVICE_CALL_FAILED with the original error message preserved,
not idempotent-succeed. Symmetric counterpart to
test_remove_helpers_integrations_subentry_not_found_is_idempotent
which pins the positive (idempotent) case.
74 unit tests pass across test_tools_integrations.py (52) and
test_config_subentries_folded.py (22).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 23a19a3 commit 3cb4fd7
2 files changed
Lines changed: 96 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
526 | 526 | | |
527 | 527 | | |
528 | 528 | | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
328 | 328 | | |
329 | 329 | | |
330 | 330 | | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
331 | 398 | | |
332 | 399 | | |
333 | 400 | | |
| |||
0 commit comments