Skip to content

Refactor BaseApiDepositClient to get rid of the _client argument

This argument was only there to make it easier to mock the HTTP calls (via a mocked requests). Thanks to the mockup capabilities, this is in fact not necessary. So get rid of it and replace its usage in tests by proper use of the mocker pytest fixture.

Also:

  • refactor this BaseApiDepositClient constructor to acces directly "url" and "auth" kwargs instead of an unspecified generic config dict (still supported but deprecated),
  • get rid of a few actually not really needed fixtures (deposit_config)
  • rewrite PrivateApiDepositClientStatusUpdateTest as a couple of pytest functions,
  • get rid of onliners functions in swh.deposit.cli.client (_client(), deposit_create, deposit_update).

Migrated from D4431 (view on Phabricator)

Merge request reports

Loading