diff --git a/swh/web/browse/views/directory.py b/swh/web/browse/views/directory.py --- a/swh/web/browse/views/directory.py +++ b/swh/web/browse/views/directory.py @@ -129,8 +129,10 @@ 'revision_id': None } - swh_ids = get_swh_persistent_ids([{'type': 'directory', - 'id': sha1_git}]) + swh_objects = [{'type': 'directory', 'id': sha1_git}] + + swh_ids = get_swh_persistent_ids( + swh_objects=swh_objects, snapshot_context=snapshot_context) heading = 'Directory - %s' % sha1_git if breadcrumbs: @@ -155,7 +157,7 @@ 'swh_ids': swh_ids}) -@browse_route(r'directory/resolve/content-path/(?P[0-9a-f]+)/(?P.+)/', # noqa +@browse_route(r'directory/resolve/content-path/(?P[0-9a-f]+)/(?P.+)/', # noqa view_name='browse-directory-resolve-content-path', checksum_args=['sha1_git']) def _directory_resolve_content_path(request, sha1_git, path): diff --git a/swh/web/tests/browse/views/test_directory.py b/swh/web/tests/browse/views/test_directory.py --- a/swh/web/tests/browse/views/test_directory.py +++ b/swh/web/tests/browse/views/test_directory.py @@ -60,6 +60,20 @@ assert resp['location'] == redirect_url +@given(directory()) +def test_permalink_box_context(client, directory): + sha1_git = "2a9e0d6dee8dc7c87c22fd56731ab5c732282eab" + origin_url = "https://github.com/memononen/libtess2" + url = reverse('browse-directory', + url_args={'sha1_git': sha1_git}, + query_params={'origin': origin_url}) + + resp = client.get(url) + + assert resp.status_code == 200 + assert_contains(resp, '
') + + def _directory_view(client, root_directory_sha1, directory_entries, path=None): dirs = [e for e in directory_entries if e['type'] in ('dir', 'rev')]