Changeset View
Changeset View
Standalone View
Standalone View
swh/web/tests/common/test_utils.py
Show First 20 Lines • Show All 106 Lines • ▼ Show 20 Lines | def test_get_swh_persistent_id(): | ||||
with pytest.raises(BadInputExc) as e: | with pytest.raises(BadInputExc) as e: | ||||
utils.get_swh_persistent_id('foo', sha1_git) | utils.get_swh_persistent_id('foo', sha1_git) | ||||
assert e.match('Invalid object') | assert e.match('Invalid object') | ||||
with pytest.raises(BadInputExc) as e: | with pytest.raises(BadInputExc) as e: | ||||
utils.get_swh_persistent_id(swh_object_type, 'not a valid id') | utils.get_swh_persistent_id(swh_object_type, 'not a valid id') | ||||
assert e.match('Invalid object') | assert e.match('Invalid object') | ||||
def test_group_swh_persistent_identifiers_bad_input(): | |||||
sha1_git = 'aafb16d69fd30ff58afdd69036a26047f3aebdc6' | |||||
invalid_pid_sha1 = ['swh:1:cnt:aafb16d69fd30ff58afdd69036a26047f3aebdc;'] | |||||
invalid_pid_type = ['swh:1:dri:%s' % sha1_git] | |||||
with pytest.raises(BadInputExc): | |||||
utils.group_swh_persistent_identifiers(invalid_pid_sha1) | |||||
with pytest.raises(BadInputExc): | |||||
utils.group_swh_persistent_identifiers(invalid_pid_type) | |||||
vlorentz: this should be in `swh/web/tests/api/test_identifiers.py` |
this should be in swh/web/tests/api/test_identifiers.py