api_client = <rest_framework.test.APIClient object at 0x7f45ddfd8e80>
archive_data = <swh.web.tests.conftest._ArchiveData object at 0x7f45ddfd8f28>
tests_data = {'contents': [{'blake2s256': 'e91d48e652a7f3f9f856464f7b1f409513964cfa0170e71800c6d0868400bac9', 'data': '{\n "name":...4f1e4fd0886a512f44', '144df5a57df1e6f00d86fa6d928f79a3c4e7aefe', '16025938cc940df75a37408a399408bfff6257af', ...], ...}
mocker = <pytest_mock.plugin.MockerFixture object at 0x7f45ddfd8f98>
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},
)
.tox/py3/lib/python3.7/site-packages/swh/web/tests/api/views/test_origin.py:674:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
viewname = 'api-1-origin-search', url_args = {'url_pattern': 'foobar'}
query_params = {'limit': 1050}, current_app = None, urlconf = None
request = None
def reverse(
viewname: str,
url_args: Optional[Dict[str, Any]] = None,
query_params: Optional[QueryParameters] = None,
current_app: Optional[str] = None,
urlconf: Optional[str] = None,
request: Optional[HttpRequest] = None,
) -> str:
"""An override of django reverse function supporting query parameters.
Args:
viewname: the name of the django view from which to compute a url
url_args: dictionary of url arguments indexed by their names
query_params: dictionary of query parameters to append to the
reversed url
current_app: the name of the django app tighten to the view
urlconf: url configuration module
request: build an absolute URI if provided
Returns:
str: the url of the requested view with processed arguments and
query parameters
"""
if url_args:
url_args = {k: v for k, v in url_args.items() if v is not None}
url = django_reverse(
viewname, urlconf=urlconf, kwargs=url_args, current_app=current_app
)
if query_params:
query_params_dict = {k: v for k, v in query_params.items() if v is not None}
if len(query_params_dict) > 0:
query_dict = QueryDict("", mutable=True)
for k in sorted(query_params_dict.keys()):
value = query_params_dict[k]
> assert isinstance(value, str)
E assert False
E + where False = isinstance(1050, str)
.tox/py3/lib/python3.7/site-packages/swh/web/common/utils.py:104: AssertionError
TEST RESULT
TEST RESULT
- Run At
- May 25 2022, 4:46 PM