You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
test: add offline tests for delete resource, artifact and dispatch - #128
Adds tests/test_delete_resource.py, offline tests for the parts of api/delete.py that had no tests yet. Only this one file is added, no source changes.
delete.py coverage was 52%. With these tests it is 100%. DeleteQueue, _confirm_delete and _delete_group were already covered.
What is tested:
_delete_resource: the DELETE request and its X-API-KEY header, 200/204 recorded in the manifest, an error status raises, dry run sends nothing and records dry_run, a queue only queues, a missing key raises, and the skip / cancel / confirm answers
_delete_artifact: one version (dict), several versions (list), no versions, versions without @id. In all cases versions are deleted first, then the artifact
delete(): collection, version, artifact and group URIs go to the right helper, file and account URIs do nothing, and queued deletes run deepest first
requests.delete and fetch_databus_jsonld are monkeypatched, so nothing touches the network.
I also broke delete.py on purpose in 7 ways (e.g. dropping 204, ignoring the queue, never running the queue) and each one made at least one new test fail.
Related Issues
None.
Type of change
Bug fix (non-breaking change which fixes an issue)
New feature (non-breaking change which adds functionality)
Breaking change (fix or feature that would cause existing functionality to change)
No actionable comments were generated in the recent review.
Walkthrough
Adds offline tests for resource deletion requests, artifact version deletion, and URI-based deletion dispatch. The tests use fakes to record HTTP DELETE calls and stub JSON-LD fetching.
This change adds tests for deletion behavior and does not alter production code, so merge risk is minimal.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the change accurately: it adds offline tests for the delete resource, artifact, and dispatch logic in api/delete.py. The changeset adds only tests/test_delete_resource.py, which covers…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Description check
The description is well filled in. It explains what the PR adds (tests/test_delete_resource.py, no source changes), lists the covered behaviours, reports coverage rising from 52% to 100%, and notes th…
Full details: Title check
Explanation
The title names the change accurately: it adds offline tests for the delete resource, artifact, and dispatch logic in api/delete.py. The changeset adds only tests/test_delete_resource.py, which covers those three areas. The title is specific and matches the main change, so it passes.
Full details: Description check
Explanation
The description is well filled in. It explains what the PR adds (tests/test_delete_resource.py, no source changes), lists the covered behaviours, reports coverage rising from 52% to 100%, and notes the mocking approach and mutation checks. It sets the type of change to Housekeeping and ticks the ruff, self-review, and test checkboxes with reported results (pytest 300 passed, 3 skipped; ruff check clean). Related Issues says None. Two template items are not ticked: the commenting checkbox and the documentation checkbox. Both are reasonable to leave unchecked for a test-only change. The description is mostly complete, so the check passes.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: 408e8d62-d8f3-4921-8661-45a3da937853
Commits
Reviewing files that changed from the base of the PR and between b35bd2c and 2a14880.
Files selected for processing: 1
tests/test_delete_resource.py
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.
This branch has not been deployed
No deployments
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
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.
Pull Request
Description
Adds
tests/test_delete_resource.py, offline tests for the parts ofapi/delete.pythat had no tests yet. Only this one file is added, no source changes.delete.pycoverage was 52%. With these tests it is 100%.DeleteQueue,_confirm_deleteand_delete_groupwere already covered.What is tested:
_delete_resource: the DELETE request and itsX-API-KEYheader, 200/204 recorded in the manifest, an error status raises, dry run sends nothing and recordsdry_run, a queue only queues, a missing key raises, and the skip / cancel / confirm answers_delete_artifact: one version (dict), several versions (list), no versions, versions without@id. In all cases versions are deleted first, then the artifactdelete(): collection, version, artifact and group URIs go to the right helper, file and account URIs do nothing, and queued deletes run deepest firstrequests.deleteandfetch_databus_jsonldare monkeypatched, so nothing touches the network.I also broke
delete.pyon purpose in 7 ways (e.g. dropping 204, ignoring the queue, never running the queue) and each one made at least one new test fail.Related Issues
None.
Type of change
Checklist:
pytest- 300 passed, 3 skippedruff check(0.5.7) - no linting errorsHappy to change anything.