Page MenuHomeSoftware Heritage

Jenkins > .tox.py3.lib.python3.7.site-packages.swh.web.tests.common.test_identifiers::Tests / Python tests / test_resolve_swhids_snapshot_context
Failed

TEST RESULT

Run At
Aug 4 2020, 2:43 PM
Details
client = <django.test.client.Client object at 0x7f394d94b668> archive_data = <swh.web.tests.conftest._ArchiveData object at 0x7f3954243898> @given(origin_with_multiple_visits()) > def test_resolve_swhids_snapshot_context(client, archive_data, origin): .tox/py3/lib/python3.7/site-packages/swh/web/tests/common/test_identifiers.py:421: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ .tox/py3/lib/python3.7/site-packages/swh/web/tests/common/test_identifiers.py:472: in test_resolve_swhids_snapshot_context _check_resolved_swhid_browse_url(REVISION, rev, snapshot_context) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ object_type = 'revision', object_id = '3bd01955e961aa2e6e1b6f9cd9e003f94273584e' snapshot_context = {'branch': 'refs/remotes/origin/master', 'branches': [{'date': '18 December 2018, 19:31 UTC', 'directory': '5b61d50ef3...thub.com/wcoder/highlightjs-line-numbers.js&snapshot=da8abf3ec5203afa1561754a041aca64d7580ec2', 'is_empty': False, ...} path = None, lines = None def _check_resolved_swhid_browse_url( object_type, object_id, snapshot_context, path=None, lines=None ): snapshot_id = snapshot_context["snapshot_id"] origin_url = None if snapshot_context["origin_info"]: origin_url = snapshot_context["origin_info"]["url"] obj_context = {} query_params = {} if origin_url: obj_context["origin"] = origin_url query_params["origin_url"] = origin_url obj_context["visit"] = gen_swhid(SNAPSHOT, snapshot_id) query_params["snapshot"] = snapshot_id if object_type in (CONTENT, DIRECTORY, REVISION): if snapshot_context["release"]: obj_context["anchor"] = gen_swhid(RELEASE, snapshot_context["release_id"]) query_params["release"] = snapshot_context["release"] else: obj_context["anchor"] = gen_swhid(REVISION, snapshot_context["revision_id"]) if ( snapshot_context["branch"] and snapshot_context["branch"] != snapshot_context["revision_id"] ): branch = snapshot_context["branch"] if branch == "HEAD": for b in snapshot_context["branches"]: if ( b["revision"] == snapshot_context["revision_id"] and b["name"] != "HEAD" ): branch = b["name"] break query_params["branch"] = branch elif object_type != REVISION: query_params["revision"] = snapshot_context["revision_id"] if path: obj_context["path"] = path if path != "/": if object_type == CONTENT: query_params["path"] = path[1:] else: query_params["path"] = path[1:-1] if object_type == DIRECTORY: object_id = snapshot_context["root_directory"] if lines: obj_context["lines"] = lines obj_swhid = gen_swhid(object_type, object_id, metadata=obj_context) obj_swhid_resolved = resolve_swhid(obj_swhid) url_args = {"sha1_git": object_id} if object_type == CONTENT: url_args = {"query_string": f"sha1_git:{object_id}"} elif object_type == SNAPSHOT: url_args = {"snapshot_id": object_id} expected_url = reverse( f"browse-{object_type}", url_args=url_args, query_params=query_params, ) if lines: lines_number = lines.split("-") expected_url += f"#L{lines_number[0]}" if len(lines_number) > 1: expected_url += f"-L{lines_number[1]}" > assert obj_swhid_resolved["browse_url"] == expected_url E AssertionError: assert '/browse/revi...aca64d7580ec2' == '/browse/revi...aca64d7580ec2' E - /browse/revision/3bd01955e961aa2e6e1b6f9cd9e003f94273584e/?branch=refs/remotes/origin/master&origin_url=https://github.com/wcoder/highlightjs-line-numbers.js&snapshot=da8abf3ec5203afa1561754a041aca64d7580ec2 E ? ^ ^^^^ ------- E + /browse/revision/3bd01955e961aa2e6e1b6f9cd9e003f94273584e/?branch=refs/heads/master&origin_url=https://github.com/wcoder/highlightjs-line-numbers.js&snapshot=da8abf3ec5203afa1561754a041aca64d7580ec2 E ? ^ ^^ .tox/py3/lib/python3.7/site-packages/swh/web/tests/common/test_identifiers.py:586: AssertionError