diff --git a/swh/indexer/tests/storage/test_storage.py b/swh/indexer/tests/storage/test_storage.py --- a/swh/indexer/tests/storage/test_storage.py +++ b/swh/indexer/tests/storage/test_storage.py @@ -8,6 +8,7 @@ import pytest +from swh.core.api import RemoteException from swh.model.hashutil import hash_to_bytes from swh.indexer.storage.interface import IndexerStorageInterface @@ -253,7 +254,7 @@ # when endpoint(storage, etype, 'add')([data_rev1]) - with pytest.raises(ValueError): + with pytest.raises((ValueError, RemoteException)): endpoint(storage, etype, 'add')( [data_rev2, data_rev2], conflict_update=True) @@ -317,13 +318,17 @@ self, swh_indexer_storage): """mimetype_get_range call with wrong limit input should fail""" storage = swh_indexer_storage - with pytest.raises(ValueError) as e: + with pytest.raises((ValueError, RemoteException)) as e: storage.content_mimetype_get_range( start=None, end=None, indexer_configuration_id=None, limit=None) - assert e.value.args == ( - 'Development error: limit should not be None',) + msg = 'Development error: limit should not be None' + + if type(e.value) == RemoteException: + assert msg in e.value.args[0]['args'] + else: + assert msg in e.value.args def test_generate_content_mimetype_get_range_no_limit( self, swh_indexer_storage_with_data): @@ -925,13 +930,17 @@ self, swh_indexer_storage_with_data): storage, data = swh_indexer_storage_with_data """license_get_range call with wrong limit input should fail""" - with pytest.raises(ValueError) as e: + with pytest.raises((ValueError, RemoteException)) as e: storage.content_fossology_license_get_range( start=None, end=None, indexer_configuration_id=None, limit=None) - assert e.value.args == ( - 'Development error: limit should not be None',) + msg = 'Development error: limit should not be None' + + if type(e.value) == RemoteException: + assert msg in e.value.args[0]['args'] + else: + assert msg in e.value.args def test_generate_content_fossology_license_get_range_no_limit( self, swh_indexer_storage_with_data): @@ -1424,7 +1433,7 @@ # when storage.revision_intrinsic_metadata_add([metadata_rev]) - with pytest.raises(ValueError): + with pytest.raises((ValueError, RemoteException)): storage.origin_intrinsic_metadata_add([ metadata_origin, metadata_origin])