client = <django.test.client.Client object at 0x7f82508112e8>
mocker = <pytest_mock.plugin.MockerFixture object at 0x7f8250811320>
@given(origin())
> def test_origin_empty_snapshot(client, mocker, origin):
.tox/py3/lib/python3.7/site-packages/swh/web/tests/browse/views/test_origin.py:678:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
client = <django.test.client.Client object at 0x7f82508112e8>
mocker = <pytest_mock.plugin.MockerFixture object at 0x7f8250811320>
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_origin_empty_snapshot(client, mocker, origin):
mock_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_archive.lookup_snapshot_sizes.return_value = {
"alias": 0,
"revision": 0,
"release": 0,
}
mock_archive.lookup_origin.return_value = origin
url = reverse("browse-origin-directory", query_params={"origin_url": origin["url"]})
resp = check_html_get_response(
client, url, status_code=200, template_used="browse/directory.html"
)
resp_content = resp.content.decode("utf-8")
assert re.search("snapshot.*is empty", resp_content)
assert not re.search("swh-tr-link", resp_content)
assert mock_get_origin_visit_snapshot.called
> assert mock_archive.lookup_snapshot_sizes.called
E AssertionError: assert False
E + where False = <MagicMock name='archive.lookup_snapshot_sizes' id='140197675611528'>.called
E + where <MagicMock name='archive.lookup_snapshot_sizes' id='140197675611528'> = <MagicMock name='archive' id='140197675849432'>.lookup_snapshot_sizes
.tox/py3/lib/python3.7/site-packages/swh/web/tests/browse/views/test_origin.py:699: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Aug 12 2021, 3:52 PM