HomeSoftware Heritage

api/tests: add pytest plumbing for testing rpc client/server stack as a whole

Description

api/tests: add pytest plumbing for testing rpc client/server stack as a whole

This uses both

  • the client test fixture (from pytest-flask) to allow to easily call RPCServerApp based application methods,
  • a requests Adapter class to make the RPCClient based proxy route the HTTP requests directly to the RPCServerApp test client above, without the need for a running HTTP server.

This adapter overload the send() method to call the Flake test app open()
method (instead of doing a real network connection), and convert the
wertzeug based Response object into a requests one.

Also add a few tests for the RPC client/server communication provided in
swh.core.api via RPCServerApp and RPCClient classes.

Details

Provenance
douarddaAuthored on Oct 10 2019, 4:02 PM
douarddaPushed on Oct 11 2019, 2:25 PM
Differential Revision
D2116: api/tests: add a few test for the whole rpc client/server stack
Parents
rDCORE18e4be541fea: api: fix swh.core.api.decode_request on python 3.5
Branches
Unknown
Tags
Unknown
References
tag: v0.0.74
Build Status
Buildable 8335
Build 12060: test-and-buildJenkins