diff --git a/swh/objstorage/tests/objstorage_testing.py b/swh/objstorage/tests/objstorage_testing.py --- a/swh/objstorage/tests/objstorage_testing.py +++ b/swh/objstorage/tests/objstorage_testing.py @@ -6,6 +6,7 @@ import time import collections +from swh.core.api import RemoteException from swh.objstorage import exc from swh.objstorage.objstorage import compute_hash @@ -77,10 +78,12 @@ def test_get_missing(self): content, obj_id = self.hash_content(b'get_missing') - with self.assertRaises(exc.ObjNotFoundError) as e: + with self.assertRaises((exc.ObjNotFoundError, RemoteException)) as e: self.storage.get(obj_id) - - self.assertIn(obj_id, e.exception.args) + if type(e.exception) == RemoteException: + self.assertIn('404 not found', e.exception.args) + else: + self.assertIn(obj_id, e.exception.args) def test_check_missing(self): content, obj_id = self.hash_content(b'check_missing') @@ -106,7 +109,7 @@ content, obj_id = self.hash_content(b'content_to_delete') self.storage.add(content, obj_id=obj_id) self.assertTrue(self.storage.delete(obj_id)) - with self.assertRaises(exc.Error): + with self.assertRaises((exc.Error, RemoteException)): self.storage.get(obj_id) def test_delete_not_allowed(self):