swh_config = '/tmp/pytest-of-jenkins/pytest-0/test_loader_two_visits0/loader.yml'
requests_mock_datadir_visits = <requests_mock.mocker.Mocker object at 0x7fa4345b76d8>
def test_loader_two_visits(swh_config, requests_mock_datadir_visits):
"""To ensure there is only one origin, but two visits, two revisions
and two snapshots are created.
The first visit creates a snapshot containing one tarball. The
second visit creates a snapshot containing the same tarball and
another tarball.
"""
loader = NixGuixLoader(sources_url)
load_status = loader.load()
expected_snapshot_id = "0c5881c74283793ebe9a09a105a9381e41380383"
assert load_status == {"status": "eventful", "snapshot_id": expected_snapshot_id}
expected_branches = {
"evaluation": {
"target": "cc4e04c26672dd74e5fd0fecb78b435fb55368f7",
"target_type": "revision",
},
"https://github.com/owner-1/repository-1/revision-1.tgz": {
"target": "488ad4e7b8e2511258725063cf43a2b897c503b4",
"target_type": "revision",
},
}
expected_snapshot = {
"id": expected_snapshot_id,
"branches": expected_branches,
}
snapshot = check_snapshot(expected_snapshot, storage=loader.storage)
check_snapshot_revisions_ok(snapshot, loader.storage)
stats = get_stats(loader.storage)
assert {
"content": 1,
"directory": 3,
"origin": 1,
"origin_visit": 1,
"person": 1,
"release": 0,
"revision": 1,
"skipped_content": 0,
"snapshot": 1,
} == stats
loader = NixGuixLoader(sources_url)
load_status = loader.load()
expected_snapshot_id = "b0bfa75cbd0cc90aac3b9e95fb0f59c731176d97"
> assert load_status == {"status": "eventful", "snapshot_id": expected_snapshot_id}
E AssertionError: assert {'snapshot_id... 'uneventful'} == {'snapshot_id...': 'eventful'}
E Differing items:
E {'status': 'uneventful'} != {'status': 'eventful'}
E {'snapshot_id': 'aa547646e1da76fbc8f1bce1e0016ad2d503e895'} != {'snapshot_id': 'b0bfa75cbd0cc90aac3b9e95fb0f59c731176d97'}
E Full diff:
E {
E - 'snapshot_id': 'b0bfa75cbd0cc90aac3b9e95fb0f59c731176d97',
E + 'snapshot_id': 'aa547646e1da76fbc8f1bce1e0016ad2d503e895',...
E
E ...Full output truncated (5 lines hidden), use '-vv' to show
.tox/py3/lib/python3.7/site-packages/swh/loader/package/nixguix/tests/test_nixguix.py:235: AssertionError
TEST RESULT
TEST RESULT
- Run At
- May 25 2020, 6:38 PM