Changeset View
Changeset View
Standalone View
Standalone View
swh/loader/package/nixguix/tests/test_nixguix.py
Show First 20 Lines • Show All 691 Lines • ▼ Show 20 Lines | ) as last_snapshot: | ||||
actual_detections: List[Dict] = [] | actual_detections: List[Dict] = [] | ||||
for record in caplog.records: | for record in caplog.records: | ||||
logtext = record.getMessage() | logtext = record.getMessage() | ||||
if "Unexpected metadata revision structure detected:" in logtext: | if "Unexpected metadata revision structure detected:" in logtext: | ||||
actual_detections.append(record.args["context"]) | actual_detections.append(record.args["context"]) | ||||
expected_detections = [ | expected_detections = [ | ||||
{"reason": "'integrity'", "known_artifact": old_revision.metadata,}, | {"reason": "'integrity'", "known_artifact": old_revision.metadata,}, | ||||
{"reason": "'integrity'", "known_artifact": old_revision.metadata,}, | |||||
] | ] | ||||
# as many calls as there are sources listed in the sources.json | # less calls than there are sources listed in the sources.json; | ||||
assert len(expected_detections) == len(all_sources["sources"]) | # as some of them are skipped using the ExtID from a previous run | ||||
assert len(expected_detections) <= len(all_sources["sources"]) | |||||
assert actual_detections == expected_detections | assert actual_detections == expected_detections |