Page MenuHomeSoftware Heritage

Adding 'Add Origin info' checkbox which was missing

Authored by Iamshankhadeep on Feb 12 2020, 2:49 PM.



But if we browse the directory through its identifier and the origin info is provided as query parameter (, the "Add origin info" checkbox is missing.
Related to T2141

Diff Detail

rDWAPPS Web applications
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Could you add a test for this, to prevent regressions in the future?

Don't worry about the build failure, it's temporary and not related to your changes

I fixed the build issue in master, and retriggered the builds of this diff. The errors should disappear.

  • Adding 'Add Origin info' checkbox which was missing
  • Adding tests to check permalink-box content


Just one comment:


I would rather you test swh-id-option-origin-directory, which checks the presence of the field instead of the form. For now it's the same thing, but we might add other fields in the future.

This revision now requires changes to proceed.Feb 17 2020, 1:15 PM
anlambert added a subscriber: anlambert.
anlambert added inline comments.

The test looks good but let's try to avoid hardcoding directory sha1 and origin url.
You can use the following to do so:

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, '<form id="swh-id-options">')

I agree with @vlorentz

  • removed hardcoded data and updated as asked

Looks good to me ! Before I can accept the diff, please rebase to master, squash the commits and use a better commit message, something like:

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

Closes T2141
This revision now requires changes to proceed.Feb 17 2020, 3:18 PM

rebase to origin/master and squash commits

This revision is now accepted and ready to land.Feb 18 2020, 4:23 PM