Page MenuHomeSoftware Heritage
Paste P860

(An Untitled Masterwork)
ActivePublic

Authored by anlambert on Nov 6 2020, 4:13 PM.
______________________________________________________________________________________ test_api_endpoints_have_cors_header _______________________________________________________________________________________
client = <django.test.client.Client object at 0x7f0a94071a20>
@given(directory(), revision())
> def test_api_endpoints_have_cors_header(client, directory, revision):
swh/web/tests/api/test_apiresponse.py:154:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
swh/web/tests/api/test_apiresponse.py:166: in test_api_endpoints_have_cors_header
client, url, data=swhids, status_code=200, http_origin="https://example.org"
swh/web/tests/utils.py:97: in check_http_post_response
content_type=content_type,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
response = <Response status_code=500, "application/json">, status_code = 200, content_type = '*/*'
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

Event Timeline

anlambert edited the content of this paste. (Show Details)