test(be): Fill empty storage, nodes, and audit API tests - #2
Merged
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
🟡 Changes recommended
The nodes API error-path test uses an undocumented status code for get_node_by_fleet_id, reducing contract-accurate coverage and potentially masking deserialization behavior.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR replaces previously empty/generated backend API test stubs with real unit tests that exercise the SDK client’s request/response handling for storage, nodes, and audit endpoints, helping restore coverage above the gate.
Changes:
- Added a
json_response()helper for building mock JSON HTTP responses in tests. - Implemented success/error-path tests for
StorageApi,NodesApi, andAuditApiby patchingrest_client.requestand asserting deserialized models / raisedApiException. - Introduced shared test constants and representative payloads for these APIs.
File summaries
| File | Description |
|---|---|
| test/utils.py | Adds json_response() helper to produce JSON mock responses consistently. |
| test/test_storage_api.py | Replaces stubs with assertions for add/get/list/update/delete storage view success + error cases. |
| test/test_nodes_api.py | Replaces stubs with assertions for node fetch, power state, and list operations (success + error paths). |
| test/test_audit_api.py | Replaces stubs with assertions for audit export status, starting export, and listing audit logs (success + error paths). |
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Cursor <cursoragent@cursor.com>
dkovtun-voltagepark
approved these changes
Sep 1, 2026
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.
Empty generated API tests never called the client, so coverage fell below the 55% gate. These stubs now exercise success and error paths for storage, nodes, and audit.