Skip to content
Snippets Groups Projects
Commit fe24413f authored by Nicolas Dandrimont's avatar Nicolas Dandrimont
Browse files

Use swh.model.model helpers to compute object identifiers

This will allow us to change the signature of the `swh.model.identifiers`
functions to use model objects directly instead of dicts.
parent eb077d9c
No related branches found
No related tags found
Loading
......@@ -14,15 +14,8 @@ from django.shortcuts import render
from django.template.defaultfilters import filesizeformat
from django.utils.html import escape
from swh.model.identifiers import (
CONTENT,
DIRECTORY,
RELEASE,
REVISION,
SNAPSHOT,
snapshot_identifier,
swhid,
)
from swh.model.identifiers import CONTENT, DIRECTORY, RELEASE, REVISION, SNAPSHOT, swhid
from swh.model.model import Snapshot
from swh.web.browse.utils import (
content_display_max_size,
format_log_entries,
......@@ -59,7 +52,7 @@ from swh.web.common.utils import (
)
from swh.web.config import get_config
_empty_snapshot_id = snapshot_identifier({"branches": {}})
_empty_snapshot_id = Snapshot(branches={}).id.hex()
def _get_branch(branches, branch_name, snapshot_id):
......
......@@ -23,9 +23,9 @@ from hypothesis.strategies import (
from swh.model.hashutil import DEFAULT_ALGORITHMS, hash_to_bytes, hash_to_hex
from swh.model.hypothesis_strategies import origins as new_origin_strategy
from swh.model.hypothesis_strategies import snapshots as new_snapshot
from swh.model.identifiers import directory_identifier
from swh.model.model import (
Content,
Directory,
Person,
Revision,
RevisionType,
......@@ -245,7 +245,7 @@ def empty_directory():
Hypothesis strategy returning the empty directory ingested
into the test archive.
"""
return just(directory_identifier({"entries": []}))
return just(Directory(entries=()).id.hex())
def unknown_directory():
......
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