mock_aioresponse = <aioresponses.core.aioresponses object at 0x7fcefc173400>
event_loop = <_UnixSelectorEventLoop running=False closed=False debug=False>
aiosession = <async_generator object aiosession at 0x7fcefc22e400>
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:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.7/asyncio/base_events.py:584: in run_until_complete
return future.result()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <swh.scanner.client.Client object at 0x7fcefc0bf160>
swhid = CoreSWHID.from_string('swh:1:dir:01fa282bb80be5907505d44b4692d3fa40fad140')
async def get_origin(self, swhid: CoreSWHID) -> Optional[Any]:
"""Walk the compressed graph to discover the origin of a given swhid"""
endpoint = (
f"{self.api_url}{GRAPH_RANDOMWALK_EP}{str(swhid)}/ori/?direction="
f"backward&limit=-1&resolve_origins=true"
)
res = None
> async with self.session.get(endpoint) as resp:
E AttributeError: 'async_generator' object has no attribute 'get'
.tox/py3/lib/python3.7/site-packages/swh/scanner/client.py:45: AttributeError
TEST RESULT
TEST RESULT
- Run At
- May 9 2022, 12:44 PM