Page MenuHomeSoftware Heritage

Jenkins > .tox.py3.lib.python3.7.site-packages.swh.loader.package.npm.tests.test_npm::test_npm_loader_first_visit
Failed

TEST RESULT

Run At
Jul 31 2020, 6:54 PM
Details
swh_config = '/tmp/pytest-of-jenkins/pytest-0/test_npm_loader_first_visit0/loader.yml' requests_mock_datadir = <requests_mock.mocker.Mocker object at 0x7f165b4981d0> org_api_info = b'{\n "_id": "org",\n "_rev": "4-22484cc537f12d3023241211ee34e39d",\n "name": "org",\n "description": "A parser an...rser"\n ],\n "bugs": {\n "url": "http://github.com/mooz/org-s/issues"\n },\n "readmeFilename": "README.md"\n}\n' def test_npm_loader_first_visit(swh_config, requests_mock_datadir, org_api_info): package = "org" url = package_url(package) loader = NpmLoader(url) actual_load_status = loader.load() expected_snapshot_id = hash_to_bytes("d0587e1195aed5a8800411a008f2f2d627f18e2d") assert actual_load_status == { "status": "eventful", "snapshot_id": expected_snapshot_id.hex(), } assert_last_visit_matches( loader.storage, url, status="full", type="npm", snapshot=expected_snapshot_id ) stats = get_stats(loader.storage) assert { "content": len(_expected_new_contents_first_visit), "directory": len(_expected_new_directories_first_visit), "origin": 1, "origin_visit": 1, "person": 2, "release": 0, "revision": len(_expected_new_revisions_first_visit), "skipped_content": 0, "snapshot": 1, } == stats assert len( list(loader.storage.content_get(_expected_new_contents_first_visit)) ) == len(_expected_new_contents_first_visit) assert ( list(loader.storage.directory_missing(_expected_new_directories_first_visit)) == [] ) assert ( list(loader.storage.revision_missing(_expected_new_revisions_first_visit)) == [] ) expected_snapshot = Snapshot( id=expected_snapshot_id, branches={ b"HEAD": SnapshotBranch( target=b"releases/0.0.4", target_type=TargetType.ALIAS ), b"releases/0.0.2": SnapshotBranch( target=hash_to_bytes("d8a1c7474d2956ac598a19f0f27d52f7015f117e"), target_type=TargetType.REVISION, ), b"releases/0.0.3": SnapshotBranch( target=hash_to_bytes("5f9eb78af37ffd12949f235e86fac04898f9f72a"), target_type=TargetType.REVISION, ), b"releases/0.0.4": SnapshotBranch( target=hash_to_bytes("ba019b192bdb94bd0b5bd68b3a5f92b5acc2239a"), target_type=TargetType.REVISION, ), }, ) check_snapshot(expected_snapshot, loader.storage) snapshot_swhid = SWHID( object_type="snapshot", object_id=hash_to_hex(expected_snapshot_id) ) metadata_authority = MetadataAuthority( type=MetadataAuthorityType.FORGE, url="https://replicate.npmjs.com/", ) expected_metadata = [ RawExtrinsicMetadata( type=MetadataTargetType.SNAPSHOT, id=snapshot_swhid, authority=metadata_authority, fetcher=MetadataFetcher( name="swh.loader.package.npm.loader.NpmLoader", version=__version__, ), discovery_date=loader.visit_date, format="replicate-npm-package-json", metadata=org_api_info, origin="https://www.npmjs.com/package/org", ) ] > assert loader.storage.raw_extrinsic_metadata_get( type=MetadataTargetType.SNAPSHOT, id=snapshot_swhid, authority=metadata_authority, ) == PagedResult(next_page_token=None, results=expected_metadata,) .tox/py3/lib/python3.7/site-packages/swh/loader/package/npm/tests/test_npm.py:430: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ .tox/py3/lib/python3.7/site-packages/swh/core/db/common.py:62: in _meth return meth(self, *args, db=db, cur=cur, **kwargs) .tox/py3/lib/python3.7/site-packages/swh/storage/storage.py:1262: in raw_extrinsic_metadata_get authority_id = self._get_authority_id(authority, db, cur) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <swh.storage.storage.Storage object at 0x7f165b2c3f28> authority = MetadataAuthority(type=<MetadataAuthorityType.FORGE: 'forge'>, url='https://replicate.npmjs.com/', metadata=None) db = <swh.storage.db.Db object at 0x7f165b24d9e8> cur = <cursor object at 0x7f1661b3f900; closed: -1> def _get_authority_id(self, authority: MetadataAuthority, db, cur): authority_id = db.metadata_authority_get_id( authority.type.value, authority.url, cur ) if not authority_id: > raise StorageArgumentException(f"Unknown authority {authority}") E swh.storage.exc.StorageArgumentException: Unknown authority MetadataAuthority(type=<MetadataAuthorityType.FORGE: 'forge'>, url='https://replicate.npmjs.com/', metadata=None) .tox/py3/lib/python3.7/site-packages/swh/storage/storage.py:1379: StorageArgumentException