mocker = <pytest_mock.plugin.MockerFixture object at 0x7f70967d9048>
@given(new_snapshots(3))
> def test_get_origin_visits(mocker, snapshots):
.tox/py3/lib/python3.7/site-packages/swh/web/tests/common/test_origin_visits.py:21:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
mocker = <pytest_mock.plugin.MockerFixture object at 0x7f70967d9048>
snapshots = [Snapshot(branches=ImmutableDict({b'\x00': None, b'\x01': None}), id=hash_to_bytes('6918f60fa43365b4f818ff399dda19642a...(branches=ImmutableDict({b'\x00': None, b'\x01': None}), id=hash_to_bytes('6918f60fa43365b4f818ff399dda19642af3dc41'))]
@given(new_snapshots(3))
def test_get_origin_visits(mocker, snapshots):
mock_archive = mocker.patch("swh.web.common.archive")
mock_archive.MAX_LIMIT = 2
def _lookup_origin_visits(*args, **kwargs):
if kwargs["last_visit"] is None:
return [
{
"visit": 1,
"date": "2017-05-06T00:59:10+00:00",
"status": "full",
"snapshot": hash_to_hex(snapshots[0].id),
"type": "git",
},
{
"visit": 2,
"date": "2017-08-06T00:59:10+00:00",
"status": "full",
"snapshot": hash_to_hex(snapshots[1].id),
"type": "git",
},
]
else:
return [
{
"visit": 3,
"date": "2017-09-06T00:59:10+00:00",
"status": "full",
"snapshot": hash_to_hex(snapshots[2].id),
"type": "git",
}
]
mock_archive.lookup_origin_visits.side_effect = _lookup_origin_visits
origin_info = {
"url": "https://github.com/foo/bar",
}
origin_visits = get_origin_visits(origin_info)
> assert len(origin_visits) == 3
E assert 80 == 3
E +80
E -3
.tox/py3/lib/python3.7/site-packages/swh/web/tests/common/test_origin_visits.py:62: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Feb 2 2022, 6:37 PM