Changeset View
Changeset View
Standalone View
Standalone View
swh/loader/package/maven/tests/test_maven.py
Show First 20 Lines • Show All 265 Lines • ▼ Show 20 Lines | assert { | ||||
"origin": 1, | "origin": 1, | ||||
"origin_visit": 1, | "origin_visit": 1, | ||||
"release": 2, | "release": 2, | ||||
"revision": 0, | "revision": 0, | ||||
"skipped_content": 0, | "skipped_content": 0, | ||||
"snapshot": 1, | "snapshot": 1, | ||||
} == stats | } == stats | ||||
for version in loader.get_versions(): | |||||
_, package_info = next(loader.get_package_info(version)) | |||||
assert package_info.checksums | |||||
def test_maven_loader_2_visits_without_change( | def test_maven_loader_2_visits_without_change( | ||||
swh_storage, requests_mock, expected_snapshot | swh_storage, requests_mock, expected_snapshot | ||||
): | ): | ||||
"""With no prior visit, load a maven project ends up with 1 snapshot""" | """With no prior visit, load a maven project ends up with 1 snapshot""" | ||||
# reset requests history as some are sent by fixtures | # reset requests history as some are sent by fixtures | ||||
requests_mock.reset_mock() | requests_mock.reset_mock() | ||||
Show All 14 Lines | ): | ||||
assert_last_visit_matches(swh_storage, MVN_ORIGIN_URL, status="full", type="maven") | assert_last_visit_matches(swh_storage, MVN_ORIGIN_URL, status="full", type="maven") | ||||
# Make sure we have only one entry in history for the pom fetch, one for | # Make sure we have only one entry in history for the pom fetch, one for | ||||
# the actual download of jar, and that they're correct. | # the actual download of jar, and that they're correct. | ||||
urls_history = [str(req.url) for req in list(requests_mock.request_history)] | urls_history = [str(req.url) for req in list(requests_mock.request_history)] | ||||
assert urls_history == [ | assert urls_history == [ | ||||
MVN_ARTIFACTS[0]["url"] + ".sha1", | MVN_ARTIFACTS[0]["url"] + ".sha1", | ||||
MVN_ARTIFACTS[0]["url"] + ".md5", | |||||
MVN_ARTIFACTS[1]["url"] + ".sha1", | MVN_ARTIFACTS[1]["url"] + ".sha1", | ||||
MVN_ARTIFACTS[0]["url"], | MVN_ARTIFACTS[0]["url"], | ||||
MVN_ARTIFACTS_POM[0], | MVN_ARTIFACTS_POM[0], | ||||
MVN_ARTIFACTS[1]["url"], | MVN_ARTIFACTS[1]["url"], | ||||
MVN_ARTIFACTS_POM[1], | MVN_ARTIFACTS_POM[1], | ||||
MVN_ARTIFACTS[0]["url"] + ".sha1", | MVN_ARTIFACTS[0]["url"] + ".sha1", | ||||
MVN_ARTIFACTS[0]["url"] + ".md5", | |||||
MVN_ARTIFACTS[1]["url"] + ".sha1", | MVN_ARTIFACTS[1]["url"] + ".sha1", | ||||
] | ] | ||||
def test_maven_loader_extrinsic_metadata( | def test_maven_loader_extrinsic_metadata( | ||||
swh_storage, | swh_storage, | ||||
expected_releases, | expected_releases, | ||||
expected_json_metadata, | expected_json_metadata, | ||||
▲ Show 20 Lines • Show All 139 Lines • Show Last 20 Lines |