client = <django.test.client.Client object at 0x7f4624013588>
staff_user = <User: admin>
archive_data = <swh.web.tests.conftest._ArchiveData object at 0x7f46240135f8>
swh_scheduler = <swh.scheduler.backend.SchedulerBackend object at 0x7f46240134e0>
origin = {'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', ...}
@pytest.mark.django_db
def test_origin_sub_directory_view(
client, staff_user, archive_data, swh_scheduler, origin
):
origin_visits = archive_data.origin_visit_get(origin["url"])
visit = origin_visits[-1]
snapshot = archive_data.snapshot_get(visit["snapshot"])
snapshot_sizes = archive_data.snapshot_count_branches(snapshot["id"])
head_rev_id = archive_data.snapshot_get_head(snapshot)
head_rev = archive_data.revision_get(head_rev_id)
root_dir_sha1 = head_rev["directory"]
subdirs = [
e for e in archive_data.directory_ls(root_dir_sha1) if e["type"] == "dir"
]
branches, releases, _ = process_snapshot_branches(snapshot)
if len(subdirs) == 0:
return
subdir = random.choice(subdirs)
subdir_content = archive_data.directory_ls(subdir["target"])
subdir_path = subdir["name"]
_origin_directory_view_test_helper(
client,
staff_user,
archive_data,
origin,
visit,
snapshot_sizes,
branches,
releases,
root_dir_sha1,
subdir_content,
> path=subdir_path,
)
.tox/py3/lib/python3.7/site-packages/swh/web/tests/browse/views/test_origin.py:215:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/py3/lib/python3.7/site-packages/swh/web/tests/browse/views/test_origin.py:975: in _origin_directory_view_test_helper
assert_contains(resp, snippet)
.tox/py3/lib/python3.7/site-packages/django/test/testcases.py:454: in assertContains
self.assertTrue(real_count != 0, msg_prefix + "Couldn't find %s in response" % text_repr)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <django.test.testcases.TestCase testMethod=run>, expr = False
msg = 'False is not true : Couldn\'t find \'<a href="/api/1/raw-extrinsic-metadata/swhid/swh:1:dir:5b61d50ef35ca9a4618a3572bde947b8cccf71ad/authorities/" class="dropdown-item" role="button">\' in response'
def assertTrue(self, expr, msg=None):
"""Check that the expression is true."""
if not expr:
msg = self._formatMessage(msg, "%s is not true" % safe_repr(expr))
> raise self.failureException(msg)
E AssertionError: False is not true : Couldn't find '<a href="/api/1/raw-extrinsic-metadata/swhid/swh:1:dir:5b61d50ef35ca9a4618a3572bde947b8cccf71ad/authorities/" class="dropdown-item" role="button">' in response
/usr/lib/python3.7/unittest/case.py:692: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Jul 13 2022, 11:30 AM