Page MenuHomeSoftware Heritage

swh-scanner: integration tests
ClosedPublic

Authored by DanSeraf on Mar 6 2020, 4:40 PM.

Details

Summary

Basic tests for the scanner tool (T2299)

The test_scanner_result is using the flask live_server fixture as a backend, it simulates the response of the Web API endpoint /known/. The flask /known/ endpoint uses a predefined list of persistent identifiers available in swh.scanner.tests.data.

Diff Detail

Repository
rDTSCN Code scanner
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

DanSeraf created this revision.Mar 6 2020, 4:40 PM
DanSeraf updated this revision to Diff 9918.Mar 6 2020, 4:44 PM

make flake8 pass

I'm restarting the tests

DanSeraf updated this revision to Diff 9919.Mar 6 2020, 4:47 PM

clean flask_api.py

I'm restarting the tests

The test will fail because of D2785

You can tell Arcanist to apply both diffs before running the tests. On this page, click "Edit related revisions" > "Edit parent revisions" > add D2785

vlorentz requested changes to this revision.Mar 6 2020, 4:59 PM

Looks good! Just a couple of nitpicks:

swh/scanner/tests/test_scanner.py
17

Use "example.org" or one of its subdomains as domain, it avoids using a domain that belongs to someone.

47
def test_app(app):
    """Ensures the app not in debug mode"""
    assert not app.debug

The second argument of assert is a message to be displayed on error, not a comment.

This revision now requires changes to proceed.Mar 6 2020, 4:59 PM
DanSeraf marked 2 inline comments as done.Mar 6 2020, 5:08 PM
DanSeraf updated this revision to Diff 9936.Mar 9 2020, 5:50 PM

make tox pass

zack added a subscriber: zack.Mar 9 2020, 6:20 PM

\o/ congrats @DanSeraf !

vlorentz accepted this revision.Mar 10 2020, 10:39 AM
This revision is now accepted and ready to land.Mar 10 2020, 10:39 AM
This revision was automatically updated to reflect the committed changes.