Changeset View
Changeset View
Standalone View
Standalone View
swh/loader/package/npm/tests/test_npm.py
Show First 20 Lines • Show All 695 Lines • ▼ Show 20 Lines | def test_npm_no_artifact(swh_config, requests_mock_datadir): | ||||
url = package_url(package) | url = package_url(package) | ||||
loader = NpmLoader(url) | loader = NpmLoader(url) | ||||
actual_load_status = loader.load() | actual_load_status = loader.load() | ||||
assert actual_load_status == { | assert actual_load_status == { | ||||
"status": "failed", | "status": "failed", | ||||
} | } | ||||
assert_last_visit_matches(loader.storage, url, status="failed", type="npm") | assert_last_visit_matches(loader.storage, url, status="failed", type="npm") | ||||
def test_npm_origin_not_found(swh_config, requests_mock_datadir): | |||||
url = package_url("non-existent-url") | |||||
loader = NpmLoader(url) | |||||
assert loader.load() == {"status": "failed"} | |||||
assert_last_visit_matches( | |||||
loader.storage, url, status="not_found", type="npm", snapshot=None | |||||
) |