Changeset View
Changeset View
Standalone View
Standalone View
swh/journal/tests/journal_data.py
# Copyright (C) 2019-2020 The Software Heritage developers | # Copyright (C) 2019-2020 The Software Heritage developers | ||||
# See the AUTHORS file at the top-level directory of this distribution | # See the AUTHORS file at the top-level directory of this distribution | ||||
# License: GNU General Public License version 3, or any later version | # License: GNU General Public License version 3, or any later version | ||||
# See top-level LICENSE file for more information | # See top-level LICENSE file for more information | ||||
import datetime | import datetime | ||||
from typing import Any, Dict, List | from typing import Any, Dict, List, Type | ||||
from swh.model.hashutil import MultiHash, hash_to_bytes | from swh.model.hashutil import MultiHash, hash_to_bytes | ||||
from swh.journal.serializers import ModelObject | from swh.journal.serializers import ModelObject | ||||
from swh.journal.writer.kafka import OBJECT_TYPES | |||||
from swh.model.model import ( | |||||
BaseModel, | |||||
Content, | |||||
Directory, | |||||
Origin, | |||||
OriginVisit, | |||||
Release, | |||||
Revision, | |||||
SkippedContent, | |||||
Snapshot, | |||||
) | |||||
OBJECT_TYPES: Dict[Type[BaseModel], str] = { | |||||
Content: "content", | |||||
Directory: "directory", | |||||
Origin: "origin", | |||||
OriginVisit: "origin_visit", | |||||
Release: "release", | |||||
Revision: "revision", | |||||
SkippedContent: "skipped_content", | |||||
Snapshot: "snapshot", | |||||
} | |||||
CONTENTS = [ | CONTENTS = [ | ||||
{**MultiHash.from_data(b"foo").digest(), "length": 3, "status": "visible",}, | {**MultiHash.from_data(b"foo").digest(), "length": 3, "status": "visible",}, | ||||
] | ] | ||||
duplicate_content1 = { | duplicate_content1 = { | ||||
"length": 4, | "length": 4, | ||||
▲ Show 20 Lines • Show All 133 Lines • Show Last 20 Lines |