Skip to content
Snippets Groups Projects
Commit 6d4ddcd7 authored by Nicolas Dandrimont's avatar Nicolas Dandrimont
Browse files

RPC client/server tests: use proper pattern for call assertions

`.called_once_with` doesn't exist, so it was just returning a mock
object which was boolean True; however pytest-mock is now catching
this (correctly) as a programming error, so handle the call args of the
exception capture properly.
parent 32e534f1
No related branches found
No related tags found
1 merge request!390Add forked field to GitHub repo fixtures
......@@ -131,7 +131,9 @@ def test_api_typeerror(swh_rpc_client, mocker):
with pytest.raises(RemoteException) as exc_info:
swh_rpc_client.raise_typeerror()
assert mocked_capture_exception.called_once_with(TypeError("Did I pass through?"))
passed_exc = mocked_capture_exception.call_args[0][0]
assert isinstance(passed_exc, TypeError)
assert passed_exc.args[0] == "Did I pass through?"
assert exc_info.value.args[0]["type"] == "TypeError"
assert exc_info.value.args[0]["args"] == ["Did I pass through?"]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment