Skip to content
Snippets Groups Projects
Verified Commit 711e144e authored by Antoine R. Dumont's avatar Antoine R. Dumont
Browse files

swh.vault.tests: Migrate to swh.model.hashutil.MultiHash

parent c58b4841
No related branches found
No related tags found
No related merge requests found
......@@ -14,7 +14,7 @@ Build-Depends: debhelper (>= 9),
python3-psycopg2,
python3-setuptools,
python3-swh.core (>= 0.0.44~),
python3-swh.model (>= 0.0.18~),
python3-swh.model (>= 0.0.27~),
python3-swh.objstorage (>= 0.0.17~),
python3-swh.scheduler (>= 0.0.26~),
python3-swh.storage (>= 0.0.108~),
......@@ -25,7 +25,7 @@ Homepage: https://forge.softwareheritage.org/diffusion/DVAU/
Package: python3-swh.vault
Architecture: all
Depends: python3-swh.core (>= 0.0.44~),
python3-swh.model (>= 0.0.18~),
python3-swh.model (>= 0.0.27~),
python3-swh.objstorage (>= 0.0.17~),
python3-swh.scheduler (>= 0.0.26~),
python3-swh.storage (>= 0.0.108~),
......
swh.core >= 0.0.44
swh.model >= 0.0.18
swh.model >= 0.0.27
swh.objstorage >= 0.0.17
swh.scheduler >= 0.0.26
swh.storage >= 0.0.106
......@@ -60,5 +60,15 @@ class VaultTestFixture(StorageTestFixture):
def hash_content(content):
obj_id = hashutil.hash_data(content)['sha1']
return content, obj_id
"""Hash the content's id (sha1).
Args:
content (bytes): Content to hash
Returns:
The tuple (content, content's id as bytes)
"""
hashes = hashutil.MultiHash.from_data(
content, hash_names=['sha1']).digest()
return content, hashes['sha1']
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment