Changeset View
Changeset View
Standalone View
Standalone View
swh/model/tests/test_identifiers.py
Show First 20 Lines • Show All 909 Lines • ▼ Show 20 Lines | def test_parse_swhid(self): | ||||
namespace="swh", | namespace="swh", | ||||
scheme_version=_version, | scheme_version=_version, | ||||
object_type=_type, | object_type=_type, | ||||
object_id=_hash, | object_id=_hash, | ||||
metadata=_metadata, | metadata=_metadata, | ||||
) | ) | ||||
actual_result = identifiers.parse_swhid(swhid) | actual_result = identifiers.parse_swhid(swhid) | ||||
self.assertEqual(actual_result, expected_result) | self.assertEqual(actual_result, expected_result) | ||||
self.assertEqual( | |||||
expected_result.to_dict(), | |||||
{ | |||||
"namespace": "swh", | |||||
"scheme_version": _version, | |||||
"object_type": _type, | |||||
"object_id": _hash, | |||||
"metadata": _metadata, | |||||
}, | |||||
) | |||||
def test_parse_swhid_parsing_error(self): | def test_parse_swhid_parsing_error(self): | ||||
for swhid in [ | for swhid in [ | ||||
("swh:1:cnt"), | ("swh:1:cnt"), | ||||
("swh:1:"), | ("swh:1:"), | ||||
("swh:"), | ("swh:"), | ||||
("swh:1:cnt:"), | ("swh:1:cnt:"), | ||||
("foo:1:cnt:abc8bc9d7a6bcf6db04f476d29314f157507d505"), | ("foo:1:cnt:abc8bc9d7a6bcf6db04f476d29314f157507d505"), | ||||
▲ Show 20 Lines • Show All 141 Lines • Show Last 20 Lines |