Changeset View
Changeset View
Standalone View
Standalone View
swh/loader/package/nixguix/tests/test_nixguix.py
Show First 20 Lines • Show All 192 Lines • ▼ Show 20 Lines | expected_branches = { | ||||
"target_type": "revision", | "target_type": "revision", | ||||
}, | }, | ||||
b"https://github.com/owner-1/repository-1/revision-1.tgz": { | b"https://github.com/owner-1/repository-1/revision-1.tgz": { | ||||
"target": hash_to_bytes("488ad4e7b8e2511258725063cf43a2b897c503b4"), | "target": hash_to_bytes("488ad4e7b8e2511258725063cf43a2b897c503b4"), | ||||
"target_type": "revision", | "target_type": "revision", | ||||
}, | }, | ||||
} | } | ||||
expected_snapshot = { | expected_snapshot = { | ||||
"id": expected_snapshot_id, | "id": hash_to_bytes(expected_snapshot_id), | ||||
"branches": expected_branches, | "branches": expected_branches, | ||||
} | } | ||||
snapshot = check_snapshot(expected_snapshot, storage=loader.storage) | snapshot = check_snapshot(expected_snapshot, storage=loader.storage) | ||||
check_snapshot_revisions_ok(snapshot, loader.storage) | check_snapshot_revisions_ok(snapshot, loader.storage) | ||||
urls = [ | urls = [ | ||||
m.url | m.url | ||||
for m in requests_mock_datadir.request_history | for m in requests_mock_datadir.request_history | ||||
Show All 30 Lines | expected_branches = { | ||||
}, | }, | ||||
b"https://github.com/owner-1/repository-1/revision-1.tgz": { | b"https://github.com/owner-1/repository-1/revision-1.tgz": { | ||||
"target": hash_to_bytes("488ad4e7b8e2511258725063cf43a2b897c503b4"), | "target": hash_to_bytes("488ad4e7b8e2511258725063cf43a2b897c503b4"), | ||||
"target_type": "revision", | "target_type": "revision", | ||||
}, | }, | ||||
} | } | ||||
expected_snapshot = { | expected_snapshot = { | ||||
"id": expected_snapshot_id, | "id": hash_to_bytes(expected_snapshot_id), | ||||
"branches": expected_branches, | "branches": expected_branches, | ||||
} | } | ||||
snapshot = check_snapshot(expected_snapshot, storage=loader.storage) | snapshot = check_snapshot(expected_snapshot, storage=loader.storage) | ||||
check_snapshot_revisions_ok(snapshot, loader.storage) | check_snapshot_revisions_ok(snapshot, loader.storage) | ||||
stats = get_stats(loader.storage) | stats = get_stats(loader.storage) | ||||
assert { | assert { | ||||
"content": 1, | "content": 1, | ||||
Show All 30 Lines | expected_branches = { | ||||
}, | }, | ||||
b"https://github.com/owner-2/repository-1/revision-1.tgz": { | b"https://github.com/owner-2/repository-1/revision-1.tgz": { | ||||
"target": hash_to_bytes("85e0bad74e33e390aaeb74f139853ae3863ee544"), | "target": hash_to_bytes("85e0bad74e33e390aaeb74f139853ae3863ee544"), | ||||
"target_type": "revision", | "target_type": "revision", | ||||
}, | }, | ||||
} | } | ||||
expected_snapshot = { | expected_snapshot = { | ||||
"id": expected_snapshot_id, | "id": hash_to_bytes(expected_snapshot_id), | ||||
"branches": expected_branches, | "branches": expected_branches, | ||||
} | } | ||||
snapshot = check_snapshot(expected_snapshot, storage=loader.storage) | snapshot = check_snapshot(expected_snapshot, storage=loader.storage) | ||||
check_snapshot_revisions_ok(snapshot, loader.storage) | check_snapshot_revisions_ok(snapshot, loader.storage) | ||||
stats = get_stats(loader.storage) | stats = get_stats(loader.storage) | ||||
assert { | assert { | ||||
"content": 2, | "content": 2, | ||||
Show All 38 Lines | expected_branches = { | ||||
}, | }, | ||||
b"evaluation": { | b"evaluation": { | ||||
"target": hash_to_bytes("cc4e04c26672dd74e5fd0fecb78b435fb55368f7"), | "target": hash_to_bytes("cc4e04c26672dd74e5fd0fecb78b435fb55368f7"), | ||||
"target_type": "revision", | "target_type": "revision", | ||||
}, | }, | ||||
} | } | ||||
expected_snapshot = { | expected_snapshot = { | ||||
"id": "0c5881c74283793ebe9a09a105a9381e41380383", | "id": hash_to_bytes("0c5881c74283793ebe9a09a105a9381e41380383"), | ||||
"branches": expected_branches, | "branches": expected_branches, | ||||
} | } | ||||
snapshot = check_snapshot(expected_snapshot, storage=loader.storage) | snapshot = check_snapshot(expected_snapshot, storage=loader.storage) | ||||
check_snapshot_revisions_ok(snapshot, loader.storage) | check_snapshot_revisions_ok(snapshot, loader.storage) | ||||
def test_eoferror(swh_config, requests_mock_datadir): | def test_eoferror(swh_config, requests_mock_datadir): | ||||
Show All 10 Lines | def test_eoferror(swh_config, requests_mock_datadir): | ||||
expected_branches = { | expected_branches = { | ||||
b"evaluation": { | b"evaluation": { | ||||
"target": hash_to_bytes("cc4e04c26672dd74e5fd0fecb78b435fb55368f7"), | "target": hash_to_bytes("cc4e04c26672dd74e5fd0fecb78b435fb55368f7"), | ||||
"target_type": "revision", | "target_type": "revision", | ||||
}, | }, | ||||
} | } | ||||
expected_snapshot = { | expected_snapshot = { | ||||
"id": "4257fa2350168c6bfec726a06452ea27a2c0cb33", | "id": hash_to_bytes("4257fa2350168c6bfec726a06452ea27a2c0cb33"), | ||||
"branches": expected_branches, | "branches": expected_branches, | ||||
} | } | ||||
snapshot = check_snapshot(expected_snapshot, storage=loader.storage) | snapshot = check_snapshot(expected_snapshot, storage=loader.storage) | ||||
check_snapshot_revisions_ok(snapshot, loader.storage) | check_snapshot_revisions_ok(snapshot, loader.storage) | ||||
def fake_download( | def fake_download( | ||||
Show All 35 Lines | expected_branches = { | ||||
"target_type": "revision", | "target_type": "revision", | ||||
}, | }, | ||||
b"evaluation": { | b"evaluation": { | ||||
"target": hash_to_bytes("cc4e04c26672dd74e5fd0fecb78b435fb55368f7"), | "target": hash_to_bytes("cc4e04c26672dd74e5fd0fecb78b435fb55368f7"), | ||||
"target_type": "revision", | "target_type": "revision", | ||||
}, | }, | ||||
} | } | ||||
expected_snapshot = { | expected_snapshot = { | ||||
"id": expected_snapshot_id, | "id": hash_to_bytes(expected_snapshot_id), | ||||
"branches": expected_branches, | "branches": expected_branches, | ||||
} | } | ||||
snapshot = check_snapshot(expected_snapshot, storage=loader.storage) | snapshot = check_snapshot(expected_snapshot, storage=loader.storage) | ||||
check_snapshot_revisions_ok(snapshot, loader.storage) | check_snapshot_revisions_ok(snapshot, loader.storage) | ||||
assert len(mock_download.mock_calls) == 2 | assert len(mock_download.mock_calls) == 2 | ||||
▲ Show 20 Lines • Show All 135 Lines • Show Last 20 Lines |