Changeset View
Changeset View
Standalone View
Standalone View
swh/loader/package/nixguix/tests/test_functional.py
Show First 20 Lines • Show All 81 Lines • ▼ Show 20 Lines | |||||
def test_loader_incremental(swh_config, requests_mock_datadir): | def test_loader_incremental(swh_config, requests_mock_datadir): | ||||
"""Ensure a second visit do not download artifact already | """Ensure a second visit do not download artifact already | ||||
downloaded by the previous visit. | downloaded by the previous visit. | ||||
""" | """ | ||||
loader = NixGuixLoader(sources_url) | loader = NixGuixLoader(sources_url) | ||||
load_status = loader.load() | load_status = loader.load() | ||||
loader = NixGuixLoader(sources_url) | |||||
loader.load() | loader.load() | ||||
ardumont: Why do we use 2 loaders again?
Can you please remove it and see what happens? | |||||
expected_snapshot_id = '0c5881c74283793ebe9a09a105a9381e41380383' | expected_snapshot_id = '0c5881c74283793ebe9a09a105a9381e41380383' | ||||
assert load_status == { | assert load_status == { | ||||
'status': 'eventful', | 'status': 'eventful', | ||||
'snapshot_id': expected_snapshot_id | 'snapshot_id': expected_snapshot_id | ||||
} | } | ||||
expected_branches = { | expected_branches = { | ||||
'evaluation': { | 'evaluation': { | ||||
'target': 'cc4e04c26672dd74e5fd0fecb78b435fb55368f7', | 'target': 'cc4e04c26672dd74e5fd0fecb78b435fb55368f7', | ||||
▲ Show 20 Lines • Show All 112 Lines • ▼ Show 20 Lines | assert { | ||||
'snapshot': 2 | 'snapshot': 2 | ||||
} == stats | } == stats | ||||
def test_resolve_revision_from(swh_config, requests_mock_datadir): | def test_resolve_revision_from(swh_config, requests_mock_datadir): | ||||
loader = NixGuixLoader(sources_url) | loader = NixGuixLoader(sources_url) | ||||
known_artifacts = { | known_artifacts = { | ||||
'id1': {'extrinsic': {'raw': {'url': "url1"}}}, | 'id1': {'extrinsic': {'raw': { | ||||
'id2': {'extrinsic': {'raw': {'url': "url2"}}} | 'url': "url1", | ||||
'integrity': 'integrity1'}}}, | |||||
'id2': {'extrinsic': {'raw': { | |||||
'url': "url2", | |||||
'integrity': 'integrity2'}}}, | |||||
} | } | ||||
metadata = {'url': 'url1'} | metadata = {'url': 'url1', 'integrity': 'integrity1'} | ||||
assert loader.resolve_revision_from(known_artifacts, metadata) == 'id1' | assert loader.resolve_revision_from(known_artifacts, metadata) == 'id1' | ||||
metadata = {'url': 'url3'} | metadata = {'url': 'url3', 'integrity': 'integrity3'} | ||||
assert loader.resolve_revision_from(known_artifacts, metadata) == None # noqa | assert loader.resolve_revision_from(known_artifacts, metadata) == None # noqa | ||||
def test_evaluation_branch(swh_config, requests_mock_datadir): | def test_evaluation_branch(swh_config, requests_mock_datadir): | ||||
loader = NixGuixLoader(sources_url) | loader = NixGuixLoader(sources_url) | ||||
res = loader.load() | res = loader.load() | ||||
assert res['status'] == 'eventful' | assert res['status'] == 'eventful' | ||||
▲ Show 20 Lines • Show All 41 Lines • Show Last 20 Lines |
Why do we use 2 loaders again?
Can you please remove it and see what happens?