Changeset View
Changeset View
Standalone View
Standalone View
swh/indexer/tests/test_origin_metadata.py
# Copyright (C) 2018-2019 The Software Heritage developers | # Copyright (C) 2018-2020 The Software Heritage developers | ||||
# See the AUTHORS file at the top-level directory of this distribution | # See the AUTHORS file at the top-level directory of this distribution | ||||
# License: GNU General Public License version 3, or any later version | # License: GNU General Public License version 3, or any later version | ||||
# See top-level LICENSE file for more information | # See top-level LICENSE file for more information | ||||
from unittest.mock import patch | from unittest.mock import patch | ||||
from swh.model.hashutil import hash_to_bytes | from swh.model.hashutil import hash_to_bytes | ||||
▲ Show 20 Lines • Show All 56 Lines • ▼ Show 20 Lines | results = list(indexer.idx_storage.origin_intrinsic_metadata_get([ | ||||
origin])) | origin])) | ||||
assert len(results) == 1 | assert len(results) == 1 | ||||
def test_origin_metadata_indexer_missing_head( | def test_origin_metadata_indexer_missing_head( | ||||
idx_storage, storage, obj_storage): | idx_storage, storage, obj_storage): | ||||
storage.origin_add([{ | storage.origin_add([{ | ||||
'type': 'git', | |||||
'url': 'https://example.com' | 'url': 'https://example.com' | ||||
}]) | }]) | ||||
indexer = OriginMetadataIndexer(config=REVISION_METADATA_CONFIG) | indexer = OriginMetadataIndexer(config=REVISION_METADATA_CONFIG) | ||||
indexer.run(["https://example.com"]) | indexer.run(["https://example.com"]) | ||||
origin = 'https://example.com' | origin = 'https://example.com' | ||||
results = list(indexer.idx_storage.origin_intrinsic_metadata_get([ | results = list(indexer.idx_storage.origin_intrinsic_metadata_get([ | ||||
origin])) | origin])) | ||||
assert results == [] | assert results == [] | ||||
def test_origin_metadata_indexer_partial_missing_head( | def test_origin_metadata_indexer_partial_missing_head( | ||||
idx_storage, storage, obj_storage): | idx_storage, storage, obj_storage): | ||||
storage.origin_add([{ | storage.origin_add([{ | ||||
'type': 'git', | |||||
'url': 'https://example.com' | 'url': 'https://example.com' | ||||
}]) | }]) | ||||
indexer = OriginMetadataIndexer(config=REVISION_METADATA_CONFIG) | indexer = OriginMetadataIndexer(config=REVISION_METADATA_CONFIG) | ||||
indexer.run(["https://example.com", | indexer.run(["https://example.com", | ||||
"https://github.com/librariesio/yarn-parser"]) | "https://github.com/librariesio/yarn-parser"]) | ||||
origin1 = 'https://example.com' | origin1 = 'https://example.com' | ||||
▲ Show 20 Lines • Show All 147 Lines • Show Last 20 Lines |