Page MenuHomeSoftware Heritage

tests/api/graph: Ensure tests pass with all requests-mock versions
ClosedPublic

Authored by anlambert on Apr 28 2021, 3:30 PM.

Details

Summary

requests-mock recently changed its way to match URLs, paths are now
quoted when registering mocked URLs.

As Web API graph endpoint send HTTP requests to the Graph service
with SWHIDs in URL paths (containing ':' characters), those must
also be quoted or recent requests-mock will not find the registered
mocked URLs.

Also ensure tests still pass with older requests-mock versions.

Of course, I have tested that the endpoint still works as expected without mocked responses.

See https://github.com/jamielennox/requests-mock/commit/f072845

Diff Detail

Repository
rDWAPPS Web applications
Branch
graph-requests-mock-fixes
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 21104
Build 32753: Phabricator diff pipeline on jenkinsJenkins console · Jenkins
Build 32752: arc lint + arc unit

Event Timeline

ardumont added a subscriber: ardumont.

Thanks.

This should fix the latest master build failure (which also fails other diffs on the webapp since the new requests mock release)

This revision is now accepted and ready to land.Apr 28 2021, 3:36 PM

Build is green

Patch application report for D5637 (id=20112)

Rebasing onto 11c737df9b...

Current branch diff-target is up to date.
Changes applied before test
commit 50c6b1f01fb6de10498a89e37e901382b773eeeb
Author: Antoine Lambert <antoine.lambert@inria.fr>
Date:   Wed Apr 28 15:25:24 2021 +0200

    tests/api/graph: Ensure tests pass with all requests-mock versions
    
    requests-mock recently changed its way to match URLs, paths are now
    quoted when registering mocked URLs.
    
    As Web API graph endpoint send HTTP requests to the Graph service
    with SWHIDs in URL paths (containing ':' characters), those must
    also be quoted or recent requests-mock will not find the registered
    mocked URLs.
    
    Also ensure tests still pass with older requests-mock versions.
    
    See https://github.com/jamielennox/requests-mock/commit/f072845

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