def test_metadata_to_dict():
"""Checks valid RawExtrinsicMetadata objects don't raise an error."""
common_fields = {
"authority": {"type": "forge", "url": "https://forge.softwareheritage.org"},
"fetcher": {"name": "test-fetcher", "version": "0.0.1",},
"discovery_date": _common_metadata_fields["discovery_date"],
"format": "json",
"metadata": b'{"origin": "https://example.com", "lines": "42"}',
}
m = RawExtrinsicMetadata(
type=MetadataTargetType.ORIGIN, target=_origin_url, **_common_metadata_fields,
)
> assert m.to_dict() == {
"type": "origin",
"target": _origin_url,
"id": b"\x9b[\x94\xf7\xa7$Dwbc\xf4\xdf\xaf(7G0t-\xd8",
**common_fields,
}
E AssertionError: assert {'authority':...: 'json', ...} == {'authority':...: 'json', ...}
E Omitting 7 identical items, use -vv to show
E Differing items:
E {'id': b'\xdc\xf4\x89\xaf\xbf\xd9[1\x08\xcb\xf3?\xea\n\x1d7_os\x08'} != {'id': b'\x9b[\x94\xf7\xa7$Dwbc\xf4\xdf\xaf(7G0t-\xd8'}
E Full diff:
E {
E 'authority': {'type': 'forge', 'url': 'https://forge.softwareheritage.org'},
E 'discovery_date': datetime.datetime(2021, 1, 29, 13, 57, 9, tzinfo=datetime.timezone.utc),...
E
E ...Full output truncated (9 lines hidden), use '-vv' to show
.tox/py3/lib/python3.7/site-packages/swh/model/tests/test_model.py:827: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Feb 4 2021, 11:09 AM