client = <django.test.client.Client object at 0x7f8250f68da0>
mocker = <pytest_mock.plugin.MockerFixture object at 0x7f8250f68470>
@given(origin())
> def test_browse_origin_content_directory_empty_snapshot(client, mocker, origin):
.tox/py3/lib/python3.7/site-packages/swh/web/tests/browse/views/test_origin.py:621:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
client = <django.test.client.Client object at 0x7f8250f68da0>
mocker = <pytest_mock.plugin.MockerFixture object at 0x7f8250f68470>
origin = {'archives': ['libtess2.zip'], 'metadata': {'@context': 'https://doi.org/10.5063/schema/codemeta-2.0', 'description': ...tools oriented refactored version of GLU tessellator.'}, 'type': 'git', 'url': 'https://github.com/memononen/libtess2'}
@given(origin())
def test_browse_origin_content_directory_empty_snapshot(client, mocker, origin):
mock_snapshot_archive = mocker.patch("swh.web.browse.snapshot_context.archive")
mock_get_origin_visit_snapshot = mocker.patch(
"swh.web.browse.snapshot_context.get_origin_visit_snapshot"
)
mock_get_origin_visit_snapshot.return_value = ([], [], {})
mock_snapshot_archive.lookup_origin.return_value = origin
mock_snapshot_archive.lookup_snapshot_sizes.return_value = {
"alias": 0,
"revision": 0,
"release": 0,
}
for browse_context in ("content", "directory"):
url = reverse(
f"browse-origin-{browse_context}",
query_params={"origin_url": origin["url"], "path": "baz"},
)
resp = check_html_get_response(
client, url, status_code=200, template_used=f"browse/{browse_context}.html"
)
assert re.search("snapshot.*is empty", resp.content.decode("utf-8"))
assert mock_get_origin_visit_snapshot.called
assert mock_snapshot_archive.lookup_origin.called
> assert mock_snapshot_archive.lookup_snapshot_sizes.called
E AssertionError: assert False
E + where False = <MagicMock name='archive.lookup_snapshot_sizes' id='140197674418128'>.called
E + where <MagicMock name='archive.lookup_snapshot_sizes' id='140197674418128'> = <MagicMock name='archive' id='140197674416504'>.lookup_snapshot_sizes
.tox/py3/lib/python3.7/site-packages/swh/web/tests/browse/views/test_origin.py:646: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Aug 12 2021, 3:52 PM