Repository navigation
test: named failure-path suite - #56
Merged
Merged
Conversation
Introduces tests/test_failure_paths.py bundling the degraded-mode guarantees the SDK makes to callers into one documenting module: - TestErrorHierarchy: AuthenticationError and RequestError both inherit from ApiError, so `except ApiError` catches every error the SDK raises; ApiError carries .message plus str() alias. - TestTokenRefreshFallback: get_token falls back to a fresh login when _refresh_token raises AuthenticationError. - TestRequestFailurePaths: _request raises RequestError with the caller-supplied error_label on 401, 403, 500 and on an expected_status mismatch; a non-JSON body on a success response surfaces the raw JSONDecodeError (contract violation, not protocol failure). - TestResourceErrorLabels: resource methods wrap the underlying RequestError with a method-specific label (verified against System.get_live_overview). Each class name documents the invariant; a failing test marks a contract change, not just a bug. Co-Authored-By: Claude Opus 4.7 <[email protected]> Claude-Session: https://claude.ai/code/session_01RgkYaQACLxezeceA1hrXQs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Dritte Welle der HA-Adoptions: Benannte Failure-Path-Suite als dokumentiertes Resilience-Vertrag.
Einzelne Test-Module (test_client.py, test_system.py, …) prüfen heute ihren Happy-Path plus ein paar Negativ-Tests. Diese Datei bündelt die degraded-mode-Garantien, die der SDK Aufrufern macht, als lesbare, zusammenhängende Suite:
Was drin ist
Warum sinnvoll
Jeder Testklassen-Name dokumentiert die Invariante. Ein brechender Test bedeutet: Vertrag hat sich verschoben, nicht nur Bug. Das ergänzt die Property-Suite (Shape-Robustheit) um die „degraded contract"-Dimension.
Test plan
🤖 Generated with Claude Code
https://claude.ai/code/session_01RgkYaQACLxezeceA1hrXQs