Page MenuHomeSoftware Heritage

deposit.private.api: Expose new endpoints with no collection name
ClosedPublic

Authored by ardumont on Oct 4 2019, 4:20 PM.

Details

Summary

As those collection name are not functionaly required.

This is a requisite step for the new deposit loader [1].
We decided to implement the new deposit loader with only what's needed (to start clean).

The other functionaly equivalent existing "private" endpoints (which expose the collection name for no good reason) will be dropped soon.

Note:

  • tests: Explicit private tests in their names
  • deposit.signals: Scheduler 'load-deposit' task with those new endpoints (<- this is what needs the new endpoints [1]).

[1] https://forge.softwareheritage.org/source/swh-loader-core/browse/package-loader/swh/loader/package/deposit.py$24

Related T2024

Test Plan

tox

Diff Detail

Repository
rDDEP Push deposit
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

vlorentz requested changes to this revision.Oct 4 2019, 4:36 PM
vlorentz added inline comments.
swh/deposit/api/private/__init__.py
66–85

Where are the new tests for this method? If there is no need for new tests, then the code of the method is probably redundant with another method. (at the very least, the error message is duplicated)

swh/deposit/api/private/urls.py
38–58

Could be deduplicated by using r'^((?P<collection_name>[^/]+)/)?(?P<deposit_id>[^/]+)/check/$' in the regexps above.

swh/deposit/signals.py
95 ↗(On Diff #6958)

why not toplevel?

swh/deposit/tests/api/test_deposit_read_archive.py
98–125

what happened to these tests?

swh/deposit/tests/api/test_deposit_read_metadata.py
648–661

same

This revision now requires changes to proceed.Oct 4 2019, 4:36 PM
swh/deposit/api/private/__init__.py
66–85

It's here, see the "here we are" below.

swh/deposit/api/private/urls.py
38–58

Yes, but we will remove the new endpoint soon, as in almost immediately.
The old endpoints will be replaced by those.

swh/deposit/signals.py
95 ↗(On Diff #6958)

because i most probably forgot :)

swh/deposit/tests/api/test_deposit_check.py
172

"here we are"
(testing the new endpoints)

swh/deposit/tests/api/test_deposit_read_archive.py
97

"here we are"

swh/deposit/tests/api/test_deposit_read_metadata.py
643

"here we are"

swh/deposit/tests/api/test_deposit_update_status.py
133

"here we are"

swh/deposit/api/private/__init__.py
91

The override i mention below about the collection being unused.
We allow it in the private api context to not provide the collection.

swh/deposit/tests/api/test_deposit_read_archive.py
98–125

In the context of the "private" api, the collection is not used.
It's technically required (because inheritance stuff that we redefined in the SWHPrivateAPI mixin) but it's not used.

So we removed those.

swh/deposit/tests/api/test_deposit_read_metadata.py
648–661

same answer, collection is not required, dropping it.

This revision is now accepted and ready to land.Oct 7 2019, 11:03 AM