ValueError: <ObjectType.CONTENT: 'cnt'> is not a valid ExtendedObjectType
During handling of the above exception, another exception occurred:
swh_storage = <swh.storage.postgresql.storage.Storage object at 0x7f78852a5ef0>
datadir = '/var/lib/jenkins/workspace/DMFCD/tests-on-diff/.tox/py3/lib/python3.7/site-packages/swh/clearlydefined/tests/data'
def test_map_row_for_licensee_true_mapping_status(swh_storage, datadir):
add_content_data(swh_storage)
expected = (
MappingStatus.MAPPED,
[
RawExtrinsicMetadata(
target=ExtendedSWHID.from_string(
"swh:1:cnt:36fade77193cb6d2bd826161a0979d64c28ab4fa"
),
discovery_date=datetime(year=2021, month=2, day=6, tzinfo=timezone.utc),
authority=AUTHORITY,
fetcher=FETCHER,
format="clearlydefined-harvest-licensee-json",
origin=None,
metadata=json.dumps(
json.loads(
file_data(os.path.join(datadir, "licensee_metadata.json"))
)
).encode("utf-8"),
),
],
)
> assert (
map_row(
storage=swh_storage,
id="npm/npmjs/@fluidframework/replay-driver/revision/0.31.0/tool/licensee/"
"9.13.0.json",
metadata=gzip.compress(
file_data(os.path.join(datadir, "licensee_true.json")).encode()
),
date=datetime(year=2021, month=2, day=6, tzinfo=timezone.utc),
)
== expected
)
.tox/py3/lib/python3.7/site-packages/swh/clearlydefined/tests/test_mapping_utils.py:358:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/py3/lib/python3.7/site-packages/swh/clearlydefined/mapping_utils.py:346: in map_row
date=date,
.tox/py3/lib/python3.7/site-packages/swh/clearlydefined/mapping_utils.py:222: in map_harvest
map_sha1_and_add_in_data(storage, sha1, data, file, date, format_)
.tox/py3/lib/python3.7/site-packages/swh/clearlydefined/mapping_utils.py:133: in map_sha1_and_add_in_data
swhid = map_sha1_with_swhid(storage=storage, sha1=sha1)
.tox/py3/lib/python3.7/site-packages/swh/clearlydefined/mapping_utils.py:100: in map_sha1_with_swhid
return ExtendedSWHID(object_type=ObjectType.CONTENT, object_id=content.sha1_git)
<attrs generated init swh.model.identifiers.ExtendedSWHID>:7: in __init__
_inst_dict['object_type'] = __attr_converter_object_type(object_type)
/usr/lib/python3.7/enum.py:310: in __call__
return cls.__new__(cls, value)
/usr/lib/python3.7/enum.py:564: in __new__
raise exc
/usr/lib/python3.7/enum.py:548: in __new__
result = cls._missing_(value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <enum 'ExtendedObjectType'>, value = <ObjectType.CONTENT: 'cnt'>
@classmethod
def _missing_(cls, value):
> raise ValueError("%r is not a valid %s" % (value, cls.__name__))
E ValueError: <ObjectType.CONTENT: 'cnt'> is not a valid ExtendedObjectType
/usr/lib/python3.7/enum.py:577: ValueError
TEST RESULT
TEST RESULT
- Run At
- Mar 5 2021, 9:35 AM