Changeset View
Changeset View
Standalone View
Standalone View
swh/indexer/tests/metadata_dictionary/test_github.py
# Copyright (C) 2022 The Software Heritage developers | # Copyright (C) 2022 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 swh.indexer.codemeta import COMPACT_CONTEXT | |||||
from swh.indexer.metadata_dictionary import MAPPINGS | from swh.indexer.metadata_dictionary import MAPPINGS | ||||
def test_compute_metadata_none(): | def test_compute_metadata_none(): | ||||
""" | """ | ||||
testing content empty content is empty | testing content empty content is empty | ||||
should return None | should return None | ||||
""" | """ | ||||
▲ Show 20 Lines • Show All 92 Lines • ▼ Show 20 Lines | def test_compute_metadata_github(): | ||||
}, | }, | ||||
"network_count": 1, | "network_count": 1, | ||||
"subscribers_count": 6 | "subscribers_count": 6 | ||||
} | } | ||||
""" | """ | ||||
result = MAPPINGS["GitHubMapping"]().translate(content) | result = MAPPINGS["GitHubMapping"]().translate(content) | ||||
assert result == { | assert result == { | ||||
"@context": "https://doi.org/10.5063/schema/codemeta-2.0", | "@context": COMPACT_CONTEXT, | ||||
"type": "https://forgefed.org/ns#Repository", | "type": "https://forgefed.org/ns#Repository", | ||||
"https://forgefed.org/ns#forks": { | "forge:forks": { | ||||
"https://www.w3.org/ns/activitystreams#totalItems": 1, | "as:totalItems": 1, | ||||
"type": "https://www.w3.org/ns/activitystreams#OrderedCollection", | "type": "as:OrderedCollection", | ||||
}, | }, | ||||
"license": "https://spdx.org/licenses/GPL-3.0", | "license": "https://spdx.org/licenses/GPL-3.0", | ||||
"name": "SoftwareHeritage/swh-indexer", | "name": "SoftwareHeritage/swh-indexer", | ||||
"description": "GitHub mirror of Metadata indexer", | "description": "GitHub mirror of Metadata indexer", | ||||
"schema:codeRepository": "https://github.com/SoftwareHeritage/swh-indexer", | "schema:codeRepository": "https://github.com/SoftwareHeritage/swh-indexer", | ||||
"schema:dateCreated": "2017-01-31T13:05:39Z", | "schema:dateCreated": "2017-01-31T13:05:39Z", | ||||
"schema:dateModified": "2022-06-22T08:02:20Z", | "schema:dateModified": "2022-06-22T08:02:20Z", | ||||
} | } |