Page MenuHomeSoftware Heritage

api/revision: Fix /revision/directory endpoint and improve tests
ClosedPublic

Authored by anlambert on Nov 23 2020, 7:07 PM.

Details

Summary

That endpoint was currently returning an error 500 as some breaking changes
were missed due to the use of mocking in tests
(see https://archive.softwareheritage.org/api/1/revision/f1b94134a4b879bc55c3dacdb496690c8ebdc03f/directory/).

So fix the issue and ensure asociated tests do not use any mocks anymore.

Depends on D4566

Diff Detail

Repository
rDWAPPS Web applications
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Build is green

Patch application report for D4567 (id=16223)

Could not rebase; Attempt merge onto 5c915825bd...

Updating 5c915825..8c864c4d
Fast-forward
 swh/web/api/utils.py                      |   8 +-
 swh/web/api/views/directory.py            |   4 +-
 swh/web/api/views/revision.py             |  50 +++-------
 swh/web/tests/api/test_utils.py           |   8 +-
 swh/web/tests/api/views/test_directory.py |  10 +-
 swh/web/tests/api/views/test_revision.py  | 146 ++++++++++++++----------------
 6 files changed, 98 insertions(+), 128 deletions(-)
Changes applied before test
commit 8c864c4dd69fa91497bba4d67ace167179cd4f1f
Author: Antoine Lambert <antoine.lambert@inria.fr>
Date:   Mon Nov 23 19:02:26 2020 +0100

    api/revision: Fix /revision/directory endpoint and improve tests
    
    That endpoint was currently returning an error 500 as some breaking changes
    were missed due to the use of mocking in tests.
    
    So fix the issue and ensure asociated tests do not use any mocks anymore.

commit f5b8445c361ca7ed38c379270ba6f4c85957fdc1
Author: Antoine Lambert <antoine.lambert@inria.fr>
Date:   Mon Nov 23 17:36:30 2020 +0100

    api/utils: Rename enrich_directory to enrich_directory_entry
    
    That function only processes a single directory entry so rename it.

See https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/490/ for more details.

vlorentz added a subscriber: vlorentz.
vlorentz added inline comments.
swh/web/api/views/revision.py
150–151

not covered, btw

This revision is now accepted and ready to land.Nov 24 2020, 11:47 AM

Update: Add missing test for revision dir entry

Build is green

Patch application report for D4567 (id=16242)

Could not rebase; Attempt merge onto 5c915825bd...

Updating 5c915825..b7cb525f
Fast-forward
 swh/web/api/utils.py                      |   8 +-
 swh/web/api/views/directory.py            |   4 +-
 swh/web/api/views/revision.py             |  50 +++------
 swh/web/tests/api/test_utils.py           |   8 +-
 swh/web/tests/api/views/test_directory.py |  10 +-
 swh/web/tests/api/views/test_revision.py  | 180 ++++++++++++++++++------------
 6 files changed, 137 insertions(+), 123 deletions(-)
Changes applied before test
commit b7cb525fda0ca8964f65021ba41338dc358552e7
Author: Antoine Lambert <antoine.lambert@inria.fr>
Date:   Mon Nov 23 19:02:26 2020 +0100

    api/revision: Fix /revision/directory endpoint and improve tests
    
    That endpoint was currently returning an error 500 as some breaking changes
    were missed due to the use of mocking in tests.
    
    So fix the issue and ensure asociated tests do not use any mocks anymore.

commit f5b8445c361ca7ed38c379270ba6f4c85957fdc1
Author: Antoine Lambert <antoine.lambert@inria.fr>
Date:   Mon Nov 23 17:36:30 2020 +0100

    api/utils: Rename enrich_directory to enrich_directory_entry
    
    That function only processes a single directory entry so rename it.

See https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/493/ for more details.