Skip to content
Snippets Groups Projects
Commit 20a6073c authored by Shankhadeep Dey's avatar Shankhadeep Dey
Browse files

browse/directory: Add missing 'Add origin info' checkbox in permalinks tab

Closes T2141
parent 26c76934
1 merge request!245Adding 'Add Origin info' checkbox which was missing
# Copyright (C) 2017-2019 The Software Heritage developers
# Copyright (C) 2017-2020 The Software Heritage developers
# See the AUTHORS file at the top-level directory of this distribution
# License: GNU Affero General Public License version 3, or any later version
# See top-level LICENSE file for more information
......@@ -129,8 +129,10 @@ def directory_browse(request, sha1_git, path=None):
'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 @@ def directory_browse(request, sha1_git, path=None):
'swh_ids': swh_ids})
@browse_route(r'directory/resolve/content-path/(?P<sha1_git>[0-9a-f]+)/(?P<path>.+)/', # noqa
@browse_route(r'directory/resolve/content-path/(?P<sha1_git>[0-9a-f]+)/(?P<path>.+)/', # noqa
view_name='browse-directory-resolve-content-path',
checksum_args=['sha1_git'])
def _directory_resolve_content_path(request, sha1_git, path):
......
# Copyright (C) 2017-2019 The Software Heritage developers
# Copyright (C) 2017-2020 The Software Heritage developers
# See the AUTHORS file at the top-level directory of this distribution
# License: GNU Affero General Public License version 3, or any later version
# See top-level LICENSE file for more information
......@@ -60,6 +60,19 @@ def test_directory_uppercase(client, directory):
assert resp['location'] == redirect_url
@given(directory())
def test_permalink_box_context(client, tests_data, directory):
origin_url = random.choice(tests_data['origins'])['url']
url = reverse('browse-directory',
url_args={'sha1_git': directory},
query_params={'origin': origin_url})
resp = client.get(url)
assert resp.status_code == 200
assert_contains(resp, 'id="swh-id-option-origin-directory"')
def _directory_view(client, root_directory_sha1, directory_entries,
path=None):
dirs = [e for e in directory_entries if e['type'] in ('dir', 'rev')]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment