Changeset View
Changeset View
Standalone View
Standalone View
swh/indexer/tests/test_metadata.py
Show First 20 Lines • Show All 186 Lines • ▼ Show 20 Lines | def test_index_content_metadata_npm(self): | ||||
# given | # given | ||||
sha1s = [ | sha1s = [ | ||||
hash_to_bytes('26a9f72a7c87cc9205725cfd879f514ff4f3d8d5'), | hash_to_bytes('26a9f72a7c87cc9205725cfd879f514ff4f3d8d5'), | ||||
hash_to_bytes('d4c647f0fc257591cc9ba1722484229780d1c607'), | hash_to_bytes('d4c647f0fc257591cc9ba1722484229780d1c607'), | ||||
hash_to_bytes('02fb2c89e14f7fab46701478c83779c7beb7b069'), | hash_to_bytes('02fb2c89e14f7fab46701478c83779c7beb7b069'), | ||||
] | ] | ||||
# this metadata indexer computes only metadata for package.json | # this metadata indexer computes only metadata for package.json | ||||
# in npm context with a hard mapping | # in npm context with a hard mapping | ||||
metadata_indexer = ContentMetadataTestIndexer( | config = BASE_TEST_CONFIG.copy() | ||||
tool=TRANSLATOR_TOOL, config=BASE_TEST_CONFIG.copy()) | config['tools'] = [TRANSLATOR_TOOL] | ||||
metadata_indexer = ContentMetadataTestIndexer(config=config) | |||||
fill_obj_storage(metadata_indexer.objstorage) | fill_obj_storage(metadata_indexer.objstorage) | ||||
fill_storage(metadata_indexer.storage) | fill_storage(metadata_indexer.storage) | ||||
# when | # when | ||||
metadata_indexer.run(sha1s, policy_update='ignore-dups') | metadata_indexer.run(sha1s, policy_update='ignore-dups') | ||||
results = list(metadata_indexer.idx_storage.content_metadata_get( | results = list(metadata_indexer.idx_storage.content_metadata_get( | ||||
sha1s)) | sha1s)) | ||||
▲ Show 20 Lines • Show All 560 Lines • Show Last 20 Lines |