diff --git a/swh/indexer/tests/storage/__init__.py b/swh/indexer/tests/storage/__init__.py --- a/swh/indexer/tests/storage/__init__.py +++ b/swh/indexer/tests/storage/__init__.py @@ -6,7 +6,8 @@ from os import path import swh.storage -from hypothesis.strategies import (binary, composite, sets, one_of, +from swh.model.hashutil import MultiHash +from hypothesis.strategies import (composite, sets, one_of, uuids, tuples, sampled_from) @@ -28,13 +29,6 @@ ] -def gen_content_id(): - """Generate raw id strategy. - - """ - return binary(min_size=20, max_size=20) - - def gen_mimetype(): """Generate one mimetype strategy. @@ -70,7 +64,7 @@ _ids = draw( sets( tuples( - gen_content_id(), + uuids(), gen_mimetype(), gen_encoding() ), @@ -79,7 +73,8 @@ ) content_mimetypes = [] - for content_id, mimetype, encoding in _ids: + for uuid, mimetype, encoding in _ids: + content_id = MultiHash.from_data(uuid.bytes, {'sha1'}).digest()['sha1'] content_mimetypes.append({ 'id': content_id, 'mimetype': mimetype,