_______________________________________________________________________________________ test_api_known_swhid_some_present _endpoints_have_cors_header _______________________________________________________________________________________
api_client = <rest_frameworkdjango.test.APIclient.Client object at 0x7fb02a58a7800a94071a20>
@given(contentdirectory(), directoryrevision())
> def test_api_known_swhid_some_present(api_endpoints_have_cors_header(client, contentdirectory, directory):revision):
swh/web/tests/api/views/test_identifierstest_apiresponse.py:117:54:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
swh/web/tests/api/views/test_identifierstest_apiresponse.py:13466: in test_api_known_swhid_some_presentendpoints_have_cors_header
resp = check_api_post_responses(api_client, url, data=swhids, data=input_swhidsstatus_code=200, status_code=200)http_origin="https://example.org"
swh/web/tests/utils.py:177: in check_api_post_responses
api_client, url, status_code, content_type="application/json", data=data
swh/web/tests/utils.py:154: in check_api97: in check_http_post_response
content_type=content_type,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
response = <Response status_code=500, "application/json">, status_code = 200, content_type = 'application/json'*/*'
def _assert_http_response(
response: HttpResponse, status_code: int, content_type: str
) -> HttpResponse:
if isinstance(response, Response):
drf_response = cast(Response, response)
error_context = (
drf_response.data.pop("traceback")
if isinstance(drf_response.data, dict) and "traceback" in drf_response.data
else drf_response.data
)
else:
error_context = getattr(response, "traceback", response.content)
> assert response.status_code == status_code, error_context
E AssertionError: Traceback (most recent call last):
E File "/home/anlambert/.virtualenvs/swh/lib/python3.7/site-packages/rest_framework/views.py", line 506, in dispatch
E response = handler(request, *args, **kwargs)
E File "/home/anlambert/.virtualenvs/swh/lib/python3.7/site-packages/rest_framework/decorators.py", line 50, in handler
E return func(*args, **kwargs)
E File "/home/anlambert/swh/swh-environment/swh-web/swh/web/api/apiurls.py", line 92, in api_view_f
E response = f(request, **kwargs)
E File "/home/anlambert/swh/swh-environment/swh-web/swh/web/api/apidoc.py", line 348, in documented_view
E raise exc
E File "/home/anlambert/swh/swh-environment/swh-web/swh/web/api/apidoc.py", line 345, in documented_view
E return {"data": f(request, **kwargs), "doc_data": doc_data}
E File "/home/anlambert/swh/swh-environment/swh-web/swh/web/api/views/identifiers.py", line 106, in api_swhid_known
E missing_hashes = archive.lookup_missing_hashes(swhids_by_type)
E File "/home/anlambert/swh/swh-environment/swh-web/swh/web/common/archive.py", line 1346, in lookup_missing_hashes
E map(lambda x: hashutil.hash_to_hex(x), itertools.chain(*missing_hashes))
E File "/home/anlambert/swh/swh-environment/swh-storage/swh/storage/cassandra/storage.py", line 295, in content_missing
E res = self.content_find(content)
E File "/home/anlambert/swh/swh-environment/swh-storage/swh/storage/cassandra/storage.py", line 265, in content_find
E "content keys must contain at least one "
E swh.storage.exc.StorageArgumentException: content keys must contain at least one of: blake2s256, sha1, sha1_git, sha256
E
E assert 500 == 200
E +500
E -200
swh/web/tests/utils.py:30: AssertionError