Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F7122880
D657.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
D657.diff
View Options
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,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Dec 17, 9:12 AM (1 w, 5 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3226073
Attached To
D657: tests: Fix content generation for a unique content id generation
Event Timeline
Log In to Comment