client = <django.test.client.Client object at 0x7f45de2dad30>
archive_data = <swh.web.tests.conftest._ArchiveData object at 0x7f45de2dae80>
swh_scheduler = <swh.scheduler.backend.SchedulerBackend object at 0x7f45de2da128>
origin_with_multiple_visits = {'archives': ['highlightjs-line-numbers.js.zip', 'highlightjs-line-numbers.js_visit2.zip'], 'id': b'MZ\xc0H_lE[d\xcc\x...s://doi.org/10.5063/schema/codemeta-2.0', 'description': 'Line numbering plugin for Highlight.js'}, 'type': 'git', ...}
def test_origin_content_view(
client, archive_data, swh_scheduler, origin_with_multiple_visits
):
origin_visits = archive_data.origin_visit_get(origin_with_multiple_visits["url"])
def _get_archive_data(visit_idx):
snapshot = archive_data.snapshot_get(origin_visits[visit_idx]["snapshot"])
head_rev_id = archive_data.snapshot_get_head(snapshot)
head_rev = archive_data.revision_get(head_rev_id)
dir_content = archive_data.directory_ls(head_rev["directory"])
dir_files = [e for e in dir_content if e["type"] == "file"]
dir_file = random.choice(dir_files)
branches, releases, _ = process_snapshot_branches(snapshot)
return {
"branches": branches,
"releases": releases,
"root_dir_sha1": head_rev["directory"],
"content": get_content(dir_file["checksums"]["sha1"]),
"visit": origin_visits[visit_idx],
"snapshot_sizes": archive_data.snapshot_count_branches(snapshot["id"]),
}
tdata = _get_archive_data(-1)
_origin_content_view_test_helper(
client,
archive_data,
origin_with_multiple_visits,
origin_visits[-1],
tdata["snapshot_sizes"],
tdata["branches"],
tdata["releases"],
tdata["root_dir_sha1"],
> tdata["content"],
)
.tox/py3/lib/python3.7/site-packages/swh/web/tests/browse/views/test_content.py:849:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/py3/lib/python3.7/site-packages/swh/web/tests/browse/views/test_content.py:939: in _origin_content_view_test_helper
query_params=query_params,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
viewname = 'browse-content'
url_args = {'query_string': 'sha1_git:d8661f4ced89c46ae7199b4db2e4a2d3870bd9e1'}
query_params = {'origin_url': 'https://github.com/wcoder/highlightjs-line-numbers.js', 'path': 'CODE_OF_CONDUCT.md', 'visit_id': 2}
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(2, 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