Changeset View
Changeset View
Standalone View
Standalone View
swh/indexer/tests/test_metadata.py
Show First 20 Lines • Show All 68 Lines • ▼ Show 20 Lines | authority=MetadataAuthority( | ||||
type=MetadataAuthorityType.FORGE, | type=MetadataAuthorityType.FORGE, | ||||
url="https://example.org/", | url="https://example.org/", | ||||
), | ), | ||||
fetcher=MetadataFetcher( | fetcher=MetadataFetcher( | ||||
name="example-fetcher", | name="example-fetcher", | ||||
version="1.0.0", | version="1.0.0", | ||||
), | ), | ||||
format="application/vnd.github.v3+json", | format="application/vnd.github.v3+json", | ||||
metadata=b'{"full_name": "test software"}', | metadata=b'{"full_name": "test software", "html_url": "http://example.org/"}', | ||||
) | ) | ||||
class TestMetadata: | class TestMetadata: | ||||
""" | """ | ||||
Tests metadata_mock_tool tool for Metadata detection | Tests metadata_mock_tool tool for Metadata detection | ||||
""" | """ | ||||
▲ Show 20 Lines • Show All 146 Lines • ▼ Show 20 Lines | def test_extrinsic_metadata_indexer_github(self, mocker): | ||||
metadata_indexer.idx_storage.origin_extrinsic_metadata_get([origin]) | metadata_indexer.idx_storage.origin_extrinsic_metadata_get([origin]) | ||||
) | ) | ||||
assert results == [ | assert results == [ | ||||
OriginExtrinsicMetadataRow( | OriginExtrinsicMetadataRow( | ||||
id="https://example.org/jdoe/myrepo", | id="https://example.org/jdoe/myrepo", | ||||
tool={"id": tool["id"], **TRANSLATOR_TOOL}, | tool={"id": tool["id"], **TRANSLATOR_TOOL}, | ||||
metadata={ | metadata={ | ||||
"@context": "https://doi.org/10.5063/schema/codemeta-2.0", | "@context": "https://doi.org/10.5063/schema/codemeta-2.0", | ||||
"id": "http://example.org/", | |||||
"type": "https://forgefed.org/ns#Repository", | "type": "https://forgefed.org/ns#Repository", | ||||
"name": "test software", | "name": "test software", | ||||
}, | }, | ||||
from_remd_id=REMD.id, | from_remd_id=REMD.id, | ||||
mappings=["github"], | mappings=["github"], | ||||
) | ) | ||||
] | ] | ||||
▲ Show 20 Lines • Show All 65 Lines • Show Last 20 Lines |