api_client = <rest_framework.test.APIClient object at 0x7f865f38c9b0>
archive_data = <swh.web.tests.conftest._ArchiveData object at 0x7f865fcf7fd0>
tests_data = {'contents': [{'blake2s256': 'f121eede11829de199646a998dd8cc569be73a34069468c9c7207ce5e11345c5', 'data': '@import url(...2ef2da295d6bda4ef7', 'e6ef4f4ce72f99b86def91d2f9685609283518eb', 'e34b4b770ac7e0976a6d4a37c62e2ecce5029ec2', ...], ...}
mocker = <pytest_mock.plugin.MockerFixture object at 0x7f865f38c710>
backend = 'swh-search'
@pytest.mark.parametrize("backend", ["swh-search", "swh-storage"])
def test_api_origin_search_limit(api_client, archive_data, tests_data, mocker, backend):
if backend == "swh-search":
tests_data["search"].origin_update(
[{"url": "http://foobar/{}".format(i)} for i in range(2000)]
)
else:
# equivalent to not configuring search in the config
mocker.patch("swh.web.common.archive.search", None)
archive_data.origin_add(
[Origin(url="http://foobar/{}".format(i)) for i in range(2000)]
)
url = reverse(
"api-1-origin-search",
url_args={"url_pattern": "foobar"},
query_params={"limit": 1050},
)
> rv = check_api_get_responses(api_client, url, status_code=200)
.tox/py3/lib/python3.7/site-packages/swh/web/tests/api/views/test_origin.py:568:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/py3/lib/python3.7/site-packages/swh/web/tests/utils.py:121: in check_api_get_responses
api_client, url, status_code, content_type="application/json"
.tox/py3/lib/python3.7/site-packages/swh/web/tests/utils.py:68: in check_http_get_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
)
elif isinstance(response, StreamingHttpResponse):
error_context = getattr(response, "traceback", response.streaming_content)
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 "/var/lib/jenkins/workspace/DWAPPS/tests-on-diff/.tox/py3/lib/python3.7/site-packages/rest_framework/views.py", line 506, in dispatch
E response = handler(request, *args, **kwargs)
E File "/var/lib/jenkins/workspace/DWAPPS/tests-on-diff/.tox/py3/lib/python3.7/site-packages/rest_framework/decorators.py", line 50, in handler
E return func(*args, **kwargs)
E File "/var/lib/jenkins/workspace/DWAPPS/tests-on-diff/.tox/py3/lib/python3.7/site-packages/swh/web/api/apiurls.py", line 96, in api_view_f
E response = f(request, **kwargs)
E File "/var/lib/jenkins/workspace/DWAPPS/tests-on-diff/.tox/py3/lib/python3.7/site-packages/swh/web/api/apidoc.py", line 372, in documented_view
E raise exc
E File "/var/lib/jenkins/workspace/DWAPPS/tests-on-diff/.tox/py3/lib/python3.7/site-packages/swh/web/api/apidoc.py", line 369, in documented_view
E return {"data": f(request, **kwargs), "doc_data": doc_data}
E File "/var/lib/jenkins/workspace/DWAPPS/tests-on-diff/.tox/py3/lib/python3.7/site-packages/swh/web/api/views/origin.py", line 206, in api_origin_search
E request=request,
E File "/var/lib/jenkins/workspace/DWAPPS/tests-on-diff/.tox/py3/lib/python3.7/site-packages/swh/web/api/views/utils.py", line 68, in api_lookup
E res = lookup_fn(*args, **kwargs)
E File "/var/lib/jenkins/workspace/DWAPPS/tests-on-diff/.tox/py3/lib/python3.7/site-packages/swh/web/common/archive.py", line 333, in search_origin
E limit=limit,
E TypeError: origin_search() got an unexpected keyword argument 'query'
E
E assert 500 == 200
E +500
E -200
.tox/py3/lib/python3.7/site-packages/swh/web/tests/utils.py:34: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Aug 6 2021, 3:43 PM