self = <swh.indexer.tests.test_metadata.TestMetadata object at 0x7fd9339e7e80>
def test_directory_metadata_indexer_single_root_dir(self):
metadata_indexer = DirectoryMetadataIndexer(config=DIRECTORY_METADATA_CONFIG)
fill_obj_storage(metadata_indexer.objstorage)
fill_storage(metadata_indexer.storage)
# Add a parent directory, that is the only directory at the root
# of the directory
dir_ = DIRECTORY2
new_dir = Directory(
entries=(
DirectoryEntry(
name=b"foobar-1.0.0",
type="dir",
target=dir_.id,
perms=16384,
),
),
)
assert new_dir.id is not None
metadata_indexer.storage.directory_add([new_dir])
tool = metadata_indexer.idx_storage.indexer_configuration_get(
{f"tool_{k}": v for (k, v) in TRANSLATOR_TOOL.items()}
)
assert tool is not None
metadata_indexer.idx_storage.content_metadata_add(
[
ContentMetadataRow(
id=DIRECTORY2.entries[0].target,
indexer_configuration_id=tool["id"],
metadata=YARN_PARSER_METADATA,
)
]
)
metadata_indexer.run([new_dir.id])
results = list(
metadata_indexer.idx_storage.directory_intrinsic_metadata_get([new_dir.id])
)
expected_results = [
DirectoryIntrinsicMetadataRow(
id=new_dir.id,
tool=TRANSLATOR_TOOL,
metadata=YARN_PARSER_METADATA,
mappings=["npm"],
)
]
for result in results:
del result.tool["id"]
> assert results == expected_results
E AssertionError: assert [DirectoryInt...ings=['npm'])] == [DirectoryInt...ings=['npm'])]
E At index 0 diff: DirectoryIntrinsicMetadataRow(indexer_configuration_id=None, tool={'name': 'swh-metadata-translator', 'version': '0.0.2', 'configuration': {'type': 'local', 'context': 'NpmMapping'}}, id=b'\x01R\x17\xb7\xde\xcd4\xcd\xb5\xa3%\xfe-\xea:\t&q\xeb_', metadata={'@context': 'https://doi.org/10.5063/schema/codemeta-2.0'}, mappings=['npm']) != DirectoryIntrinsicMetadataRow(indexer_configuration_id=None, tool={'name': 'swh-metadata-translator', 'version': '0.0.2', 'configuration': {'type': 'local', 'context': 'NpmMapping'}}, id=b'\x01R\x17\xb7\xde\xcd4\xcd\xb5\xa...
E
E ...Full output truncated (4 lines hidden), use '-vv' to show
.tox/py3/lib/python3.7/site-packages/swh/indexer/tests/test_metadata.py:180: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Jul 21 2022, 7:31 PM