mock_aioresponse = <aioresponses.core.aioresponses object at 0x7fd690c3fe48>
event_loop = <_UnixSelectorEventLoop running=False closed=False debug=False>
aiosession = <aiohttp.client.ClientSession object at 0x7fd690c4c7f0>
def test_client_get_origin_correct_api_request(
mock_aioresponse, event_loop, aiosession
):
origin_url = (
f"{ORIGIN_URL}swh:1:dir:01fa282bb80be5907505d44b4692d3fa40fad140/ori"
f"/?direction=backward&limit=-1&resolve_origins=true"
)
mock_aioresponse.get(
origin_url, status=200, body=correct_origin_api_response,
)
client = Client(AIO_URL, aiosession)
swhid = CoreSWHID.from_string("swh:1:dir:01fa282bb80be5907505d44b4692d3fa40fad140")
> actual_result = event_loop.run_until_complete(client.get_origin(swhid))
.tox/py3/lib/python3.7/site-packages/swh/scanner/tests/test_client.py:56:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.7/asyncio/base_events.py:584: in run_until_complete
return future.result()
.tox/py3/lib/python3.7/site-packages/swh/scanner/client.py:45: in get_origin
error_response(resp.reason, resp.status, endpoint)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
reason = 'OK', status_code = 200
api_url = 'http://example.org/api/graph/randomwalk/swh:1:dir:01fa282bb80be5907505d44b4692d3fa40fad140/ori/?direction=backward&limit=-1&resolve_origins=true'
def error_response(reason: Optional[Any], status_code: int, api_url: str):
error_msg = f"{status_code} {reason}: '{api_url}'"
> raise APIError(error_msg)
E swh.scanner.exceptions.APIError: "200 OK: 'http://example.org/api/graph/randomwalk/swh:1:dir:01fa282bb80be5907505d44b4692d3fa40fad140/ori/?direction=backward&limit=-1&resolve_origins=true'"
.tox/py3/lib/python3.7/site-packages/swh/scanner/exceptions.py:32: APIError
TEST RESULT
TEST RESULT
- Run At
- Aug 22 2021, 6:42 PM