Details
Details
- Reviewers
ardumont - Group Reviewers
Reviewers - Commits
- rDDEPbd46805412a8: Check collection name when calling get_deposit_by_id, if relevant.
Diff Detail
Diff Detail
- Repository
- rDDEP Push deposit
- Lint
No Linters Available - Unit
No Unit Test Coverage - Build Status
Buildable 17479 Build 27011: Phabricator diff pipeline on jenkins Jenkins console · Jenkins Build 27010: arc lint + arc unit
Event Timeline
Comment Actions
Build is green
Patch application report for D4585 (id=16288)
Could not rebase; Attempt merge onto f612cdc00e...
Updating f612cdc0..bd468054 Fast-forward swh/deposit/api/collection.py | 42 ++++++- swh/deposit/api/common.py | 145 ++++++++++------------- swh/deposit/api/content.py | 4 +- swh/deposit/api/edit.py | 13 +- swh/deposit/api/edit_media.py | 15 ++- swh/deposit/api/private/__init__.py | 17 +-- swh/deposit/api/private/deposit_check.py | 7 +- swh/deposit/api/private/deposit_read.py | 11 +- swh/deposit/api/private/deposit_update_status.py | 10 +- swh/deposit/api/state.py | 4 +- swh/deposit/api/sword_edit.py | 13 +- swh/deposit/tests/api/test_deposit_update.py | 4 +- 12 files changed, 143 insertions(+), 142 deletions(-)
Changes applied before test
commit bd46805412a8d41b573aee776ac0a6b40aafa362 Author: Valentin Lorentz <vlorentz@softwareheritage.org> Date: Wed Nov 25 11:17:54 2020 +0100 Check collection name when calling get_deposit_by_id, if relevant. commit 85486a79e014f681aaab844998b1fa98ccc92b49 Author: Valentin Lorentz <vlorentz@softwareheritage.org> Date: Tue Nov 24 16:32:42 2020 +0100 Move Deposit creation from api/common.py to api/collection.py Motivation: 1. it's not an operation in common, only 'POST Col-IRI' may create a deposit 2. it makes the BaseAPI._deposit_put function simpler and less complex This looks like a very long commit, but there are actually four small changes. In order: 1. actually move that creation (the large block of code was moved from one file to the other) 2. make the 'deposit_id' argument of most functions of 'int' type instead of 'Optional[int]', since we now get the id very early by creating it in the Col-IRI view. 3. unfortunately, this means creating a Deposit and committing it directly to the DB, which changes the behavior of the API, as it used to run checks *before* committing to the DB. Therefore, instead of immediately committing to get the id, it passes the Deposit object, which will be committed later by _deposit_put if all checks pass. This means changing the 'deposit_id: int' argument of many internal functions to 'deposit: Deposit'. This is why the diff looks big, but it's actually a trivial change 4. updated test_add_metadata_to_unknown_deposit because the API now returns the right error message, as a side-effect.
See https://jenkins.softwareheritage.org/job/DDEP/job/tests-on-diff/431/ for more details.