Changeset View
Changeset View
Standalone View
Standalone View
swh/loader/package/nixguix/tests/test_nixguix.py
Show First 20 Lines • Show All 271 Lines • ▼ Show 20 Lines | def test_clean_sources_unsupported_artifacts(swh_storage, requests_mock_datadir): | ||||
clean = clean_sources(sources, unsupported_file_extensions) | clean = clean_sources(sources, unsupported_file_extensions) | ||||
assert len(clean["sources"]) == len(supported_sources) | assert len(clean["sources"]) == len(supported_sources) | ||||
def test_loader_one_visit(swh_storage, requests_mock_datadir, raw_sources): | def test_loader_one_visit(swh_storage, requests_mock_datadir, raw_sources): | ||||
loader = NixGuixLoader(swh_storage, sources_url) | loader = NixGuixLoader(swh_storage, sources_url) | ||||
load_status = loader.load() | load_status = loader.load() | ||||
expected_snapshot_id_hex = "efe5145f85af3fc87f34102d8b8481cd5198f4f8" | expected_snapshot_id = SNAPSHOT1.id | ||||
expected_snapshot_id = hash_to_bytes(expected_snapshot_id_hex) | expected_snapshot_id_hex = expected_snapshot_id.hex() | ||||
assert load_status == { | assert load_status == { | ||||
"status": "eventful", | "status": "eventful", | ||||
"snapshot_id": expected_snapshot_id_hex, | "snapshot_id": expected_snapshot_id_hex, | ||||
} | } | ||||
release_id = hash_to_bytes("df7811b9644ed8ef088e2e7add62ed32b0bab15f") | release_id = SNAPSHOT1.branches[ | ||||
expected_snapshot = Snapshot( | b"https://github.com/owner-1/repository-1/revision-1.tgz" | ||||
id=expected_snapshot_id, | ].target | ||||
branches={ | check_snapshot(SNAPSHOT1, storage=swh_storage) | ||||
b"evaluation": SnapshotBranch( | |||||
target=hash_to_bytes("cc4e04c26672dd74e5fd0fecb78b435fb55368f7"), | |||||
target_type=TargetType.REVISION, | |||||
), | |||||
b"https://github.com/owner-1/repository-1/revision-1.tgz": SnapshotBranch( | |||||
target=release_id, target_type=TargetType.RELEASE, | |||||
), | |||||
}, | |||||
) | |||||
check_snapshot(expected_snapshot, storage=swh_storage) | |||||
assert swh_storage.release_get([release_id])[0] == Release( | assert swh_storage.release_get([release_id])[0] == Release( | ||||
id=release_id, | id=release_id, | ||||
name=b"https://github.com/owner-1/repository-1/revision-1.tgz", | name=b"https://github.com/owner-1/repository-1/revision-1.tgz", | ||||
message=None, | message=None, | ||||
target=hash_to_bytes("4de2e07d3742718d928e974b8a4c721b9f7b33bf"), | target=hash_to_bytes("4de2e07d3742718d928e974b8a4c721b9f7b33bf"), | ||||
target_type=ObjectType.DIRECTORY, | target_type=ObjectType.DIRECTORY, | ||||
synthetic=True, | synthetic=True, | ||||
▲ Show 20 Lines • Show All 347 Lines • Show Last 20 Lines |