Page MenuHomeSoftware Heritage

test_client: Migrate metadata validation scenario to use requests_mock_datadir
ClosedPublic

Authored by ardumont on Thu, Oct 8, 7:22 PM.

Details

Summary

instead of mock

Test Plan

tox

Depends on D4205

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

ardumont created this revision.Thu, Oct 8, 7:22 PM

Build is green

Patch application report for D4206 (id=14837)

Could not rebase; Attempt merge onto cd9c04afe6...

Updating cd9c04af..b035c959
Fast-forward
 conftest.py                                        |   6 +-
 pytest.ini                                         |   2 +-
 swh/deposit/cli/client.py                          | 109 +++++++++++----------
 swh/deposit/tests/cli/test_client.py               | 103 +++++++++++--------
 swh/deposit/tests/conftest.py                      |  14 +++
 .../data/https_deposit.swh.test/1_servicedocument  |  26 +++++
 .../tests/data/https_deposit.swh.test/1_test       |  19 ++++
 swh/deposit/tests/loader/conftest.py               |  14 ---
 8 files changed, 185 insertions(+), 108 deletions(-)
 create mode 100644 swh/deposit/tests/data/https_deposit.swh.test/1_servicedocument
 create mode 100644 swh/deposit/tests/data/https_deposit.swh.test/1_test
Changes applied before test
commit b035c9593b6c5ccef1d8d96d15f9ef5b26d7e0d0
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Thu Oct 8 19:22:46 2020 +0200

    test_client: Migrate metadata validation scenario to use requests_mock_datadir
    
    instead of mock

commit ff8457630b548728349aae18f5cbc223c942ef02
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Thu Oct 8 19:08:34 2020 +0200

    test_client: Migrate single deposit scenario to use requests_mock_datadir

commit 2b4ad2cfe1927507b0e182ec3f15a3a733ad5ae2
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Thu Oct 8 18:41:51 2020 +0200

    test_client: Migrate collection ok test scenario to use requests_mock_datadir
    
    instead of mock

commit 7dc727087b99159335e3daf90b5a1c4180ebf5e6
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Wed Oct 7 15:56:09 2020 +0200

    cli.client: Add types

commit 98dcf27419726acb0e3cefaf1859346abffa4546
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Wed Oct 7 15:08:29 2020 +0200

    conftest: Declare swh.core pytest_plugin

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

moranegg added inline comments.
swh/deposit/tests/cli/test_client.py
257

what's an archive only deposit?
do we have that?

291

same, what's an archive-only deposit?

vlorentz added inline comments.
swh/deposit/tests/cli/test_client.py
257

we do have that. He only added a test of the documentation and didn't change the documentation itself.

ardumont added inline comments.Fri, Oct 9, 12:29 PM
swh/deposit/tests/cli/test_client.py
257

yep, i'm just inline the actual error message which may not be that good.
If we want to change it fine, but in another diff.

To answer and clarify, the "archive-only" deposit is just an intermediary step.
It won't passed into the "deposited" state, it will remain in "partial" as usual.

If it is such a case "archive-only", then the metadata part (--author and --name or --metadata are irrelevant here).

Is that clearer?

ardumont added inline comments.Fri, Oct 9, 12:32 PM
swh/deposit/tests/cli/test_client.py
257

(sorry for the typos... too bad we cannot amend those comments)

inlining*...
"it" being the deposit*...

Build is green

Patch application report for D4206 (id=14868)

Could not rebase; Attempt merge onto b9e98c0c96...

Updating b9e98c0c..c377c3b6
Fast-forward
 swh/deposit/tests/cli/test_client.py               | 85 +++++++++++++---------
 swh/deposit/tests/conftest.py                      | 14 ++++
 .../tests/data/https_deposit.swh.test/1_test       | 19 +++++
 swh/deposit/tests/loader/conftest.py               | 14 ----
 4 files changed, 82 insertions(+), 50 deletions(-)
 create mode 100644 swh/deposit/tests/data/https_deposit.swh.test/1_test
Changes applied before test
commit c377c3b66c3fcfc1093fd2f8f997ef487beebe7a
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Thu Oct 8 19:22:46 2020 +0200

    test_client: Migrate metadata validation scenario to use requests_mock_datadir
    
    instead of mock

commit af8381f853f5144ee44a49bfcfb5efb5ef8646fa
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Thu Oct 8 19:08:34 2020 +0200

    test_client: Migrate single deposit scenario to use requests_mock_datadir

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

moranegg accepted this revision.Fri, Oct 9, 3:50 PM
moranegg added inline comments.
swh/deposit/tests/cli/test_client.py
257

Ok.
As we discussed, it might be more accurate to add deposit request on your next diff:-)

This revision is now accepted and ready to land.Fri, Oct 9, 3:50 PM