Changeset View
Changeset View
Standalone View
Standalone View
swh/loader/package/archive/tests/test_archive.py
Show First 20 Lines • Show All 76 Lines • ▼ Show 20 Lines | _expected_branches_first_visit = { | ||||
b"releases/0.1.0": { | b"releases/0.1.0": { | ||||
"target_type": "revision", | "target_type": "revision", | ||||
"target": hash_to_bytes("44183488c0774ce3c957fa19ba695cf18a4a42b3"), | "target": hash_to_bytes("44183488c0774ce3c957fa19ba695cf18a4a42b3"), | ||||
}, | }, | ||||
} | } | ||||
# hash is different then before as we changed the snapshot | # hash is different then before as we changed the snapshot | ||||
# gnu used to use `release/` (singular) instead of plural | # gnu used to use `release/` (singular) instead of plural | ||||
_expected_new_snapshot_first_visit_id = ( | _expected_new_snapshot_first_visit_id = hash_to_bytes( | ||||
"c419397fd912039825ebdbea378bc6283f006bf5" # noqa | "c419397fd912039825ebdbea378bc6283f006bf5" | ||||
olasd: I don't think this noqa is needed? | |||||
Done Inline Actionsprobably not, indeed douardda: probably not, indeed | |||||
) | ) | ||||
def visit_with_no_artifact_found(swh_config, requests_mock_datadir): | def visit_with_no_artifact_found(swh_config, requests_mock_datadir): | ||||
url = URL | url = URL | ||||
unknown_artifact_url = "https://ftp.g.o/unknown/8sync-0.1.0.tar.gz" | unknown_artifact_url = "https://ftp.g.o/unknown/8sync-0.1.0.tar.gz" | ||||
loader = ArchiveLoader( | loader = ArchiveLoader( | ||||
url, | url, | ||||
▲ Show 20 Lines • Show All 64 Lines • ▼ Show 20 Lines | def test_visit_with_release_artifact_no_prior_visit(swh_config, requests_mock_datadir): | ||||
"""With no prior visit, load a gnu project ends up with 1 snapshot | """With no prior visit, load a gnu project ends up with 1 snapshot | ||||
""" | """ | ||||
loader = ArchiveLoader(url=URL, artifacts=GNU_ARTIFACTS) | loader = ArchiveLoader(url=URL, artifacts=GNU_ARTIFACTS) | ||||
actual_load_status = loader.load() | actual_load_status = loader.load() | ||||
assert actual_load_status["status"] == "eventful" | assert actual_load_status["status"] == "eventful" | ||||
assert ( | assert ( | ||||
actual_load_status["snapshot_id"] == _expected_new_snapshot_first_visit_id | hash_to_bytes(actual_load_status["snapshot_id"]) | ||||
== _expected_new_snapshot_first_visit_id | |||||
) # noqa | ) # noqa | ||||
assert_last_visit_matches(loader.storage, URL, status="full", type="tar") | assert_last_visit_matches(loader.storage, URL, status="full", type="tar") | ||||
stats = get_stats(loader.storage) | stats = get_stats(loader.storage) | ||||
assert { | assert { | ||||
"content": len(_expected_new_contents_first_visit), | "content": len(_expected_new_contents_first_visit), | ||||
"directory": len(_expected_new_directories_first_visit), | "directory": len(_expected_new_directories_first_visit), | ||||
▲ Show 20 Lines • Show All 169 Lines • Show Last 20 Lines |
I don't think this noqa is needed?