Page MenuHomeSoftware Heritage

test_client: Migrate multisteps_deposit scenario to use requests_mock_datadir
ClosedPublic

Authored by ardumont on Fri, Oct 9, 11:55 AM.

Details

Summary

Instead of mock.

Note that right now, we should be using requests_mock_datadir_visits so we can
leverage a second visit with the correct status. But this refused to work so
far. A FIXME has been added to deal with this soon.

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

ardumont created this revision.Fri, Oct 9, 11:55 AM

Build is green

Patch application report for D4213 (id=14853)

Could not rebase; Attempt merge onto 7dc727087b...

Updating 7dc72708..91c923ff
Fast-forward
 swh/deposit/cli/client.py                          |   6 +-
 swh/deposit/tests/cli/test_client.py               | 249 ++++++++++-----------
 swh/deposit/tests/conftest.py                      |  14 ++
 .../data/https_deposit.swh.test/1_servicedocument  |  26 +++
 .../tests/data/https_deposit.swh.test/1_test       |  19 ++
 .../https_deposit.test.metadata/1_servicedocument  |  26 +++
 .../tests/data/https_deposit.test.metadata/1_test  |  19 ++
 .../1_test_666_metadata                            |  19 ++
 .../https_deposit.test.metadata/1_test_666_status  |   8 +
 swh/deposit/tests/loader/conftest.py               |  14 --
 10 files changed, 249 insertions(+), 151 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
 create mode 100644 swh/deposit/tests/data/https_deposit.test.metadata/1_servicedocument
 create mode 100644 swh/deposit/tests/data/https_deposit.test.metadata/1_test
 create mode 100644 swh/deposit/tests/data/https_deposit.test.metadata/1_test_666_metadata
 create mode 100644 swh/deposit/tests/data/https_deposit.test.metadata/1_test_666_status
Changes applied before test
commit 91c923ffad090ff5002acfdcb789c3c2e7b775a8
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Fri Oct 9 11:52:37 2020 +0200

    test_client: Migrate multisteps_deposit scenario to use requests_mock_datadir
    
    Instead of mock.
    
    Note that right now, we should be using requests_mock_datadir_visits so we can
    leverage a second visit with the correct status. But this refused to work so
    far. A FIXME has been added to deal with this soon.

commit d3faa80e1dd1d97227895f012119fe37d044bdbe
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Thu Oct 8 19:32:30 2020 +0200

    test_client: Migrate slug generation scenario to use requests_mock_datadir
    
    instead of mock

commit 3917fed773647630ff78a3a2aa9414e316add909
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 3ee5ffd3962809cff6318f761b025d921824ba0a
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 1dbcd76b8c0d3b4860c1ec36276a14916bce97e3
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 6b7d5336f7018c526e310a5b1af40dc2be40010d
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Thu Oct 8 19:44:41 2020 +0200

    cli.client: Declare directly the plain type instead of the string

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

Build is green

Patch application report for D4213 (id=14870)

Could not rebase; Attempt merge onto b9e98c0c96...

Updating b9e98c0c..b18cd89d
Fast-forward
 swh/deposit/tests/cli/test_client.py               | 231 +++++++++------------
 swh/deposit/tests/conftest.py                      |  14 ++
 .../tests/data/https_deposit.swh.test/1_test       |  19 ++
 .../https_deposit.test.metadata/1_servicedocument  |  26 +++
 .../tests/data/https_deposit.test.metadata/1_test  |  19 ++
 .../1_test_666_metadata                            |  19 ++
 .../https_deposit.test.metadata/1_test_666_status  |   8 +
 swh/deposit/tests/loader/conftest.py               |  14 --
 8 files changed, 207 insertions(+), 143 deletions(-)
 create mode 100644 swh/deposit/tests/data/https_deposit.swh.test/1_test
 create mode 100644 swh/deposit/tests/data/https_deposit.test.metadata/1_servicedocument
 create mode 100644 swh/deposit/tests/data/https_deposit.test.metadata/1_test
 create mode 100644 swh/deposit/tests/data/https_deposit.test.metadata/1_test_666_metadata
 create mode 100644 swh/deposit/tests/data/https_deposit.test.metadata/1_test_666_status
Changes applied before test
commit b18cd89d4c507709973721c47d49ffff7c856763
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Fri Oct 9 11:52:37 2020 +0200

    test_client: Migrate multisteps_deposit scenario to use requests_mock_datadir
    
    Instead of mock.
    
    Note that right now, we should be using requests_mock_datadir_visits so we can
    leverage a second visit with the correct status. But this refused to work so
    far. A FIXME has been added to deal with this soon.

commit 0d71b43ad3d86f3ca8065bb5e19cbc07e8abcfd4
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Thu Oct 8 19:32:30 2020 +0200

    test_client: Migrate slug generation scenario to use requests_mock_datadir
    
    instead of mock

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/193/ for more details.

vlorentz accepted this revision.Fri, Oct 9, 2:12 PM
This revision is now accepted and ready to land.Fri, Oct 9, 2:12 PM