Changeset View
Changeset View
Standalone View
Standalone View
swh/indexer/tests/test_metadata.py
Show First 20 Lines • Show All 861 Lines • ▼ Show 20 Lines | |||||
end""" | end""" | ||||
result = self.gemspec_mapping.translate(raw_content) | result = self.gemspec_mapping.translate(raw_content) | ||||
self.assertEqual(result, { | self.assertEqual(result, { | ||||
'@context': 'https://doi.org/10.5063/schema/codemeta-2.0', | '@context': 'https://doi.org/10.5063/schema/codemeta-2.0', | ||||
'type': 'SoftwareSourceCode', | 'type': 'SoftwareSourceCode', | ||||
'author': ['Ruby Coder1'], | 'author': ['Ruby Coder1'], | ||||
}) | }) | ||||
def test_gemspec_alternative_header(self): | |||||
raw_content = b""" | |||||
require './lib/version' | |||||
Gem::Specification.new { |s| | |||||
s.name = 'rb-system-with-aliases' | |||||
s.summary = 'execute system commands with aliases' | |||||
} | |||||
""" | |||||
result = self.gemspec_mapping.translate(raw_content) | |||||
self.assertEqual(result, { | |||||
'@context': 'https://doi.org/10.5063/schema/codemeta-2.0', | |||||
'type': 'SoftwareSourceCode', | |||||
'name': 'rb-system-with-aliases', | |||||
'description': 'execute system commands with aliases', | |||||
}) | |||||
def test_revision_metadata_indexer(self): | def test_revision_metadata_indexer(self): | ||||
metadata_indexer = RevisionMetadataIndexer( | metadata_indexer = RevisionMetadataIndexer( | ||||
config=REVISION_METADATA_CONFIG) | config=REVISION_METADATA_CONFIG) | ||||
fill_obj_storage(metadata_indexer.objstorage) | fill_obj_storage(metadata_indexer.objstorage) | ||||
fill_storage(metadata_indexer.storage) | fill_storage(metadata_indexer.storage) | ||||
tool = metadata_indexer.idx_storage.indexer_configuration_get( | tool = metadata_indexer.idx_storage.indexer_configuration_get( | ||||
{'tool_'+k: v for (k, v) in TRANSLATOR_TOOL.items()}) | {'tool_'+k: v for (k, v) in TRANSLATOR_TOOL.items()}) | ||||
▲ Show 20 Lines • Show All 60 Lines • Show Last 20 Lines |