Changeset View
Changeset View
Standalone View
Standalone View
swh/counters/tests/test_journal_client.py
# Copyright (C) 2021 The Software Heritage developers | # Copyright (C) 2021 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 | |||||
from typing import Dict, Optional | from typing import Dict, Optional | ||||
import msgpack | import msgpack | ||||
from swh.counters.journal_client import ( | from swh.counters.journal_client import ( | ||||
process_journal_messages, | process_journal_messages, | ||||
process_releases, | process_releases, | ||||
process_revisions, | process_revisions, | ||||
) | ) | ||||
from swh.counters.redis import Redis | from swh.counters.redis import Redis | ||||
from swh.model.hashutil import hash_to_bytes | from swh.model.hashutil import hash_to_bytes | ||||
from swh.model.model import ( | from swh.model.model import ( | ||||
ObjectType, | ObjectType, | ||||
Person, | Person, | ||||
Release, | Release, | ||||
Revision, | Revision, | ||||
RevisionType, | RevisionType, | ||||
Timestamp, | |||||
TimestampWithTimezone, | TimestampWithTimezone, | ||||
) | ) | ||||
DATE = TimestampWithTimezone( | DATE = TimestampWithTimezone.from_datetime( | ||||
timestamp=Timestamp(seconds=0, microseconds=0), offset=0, negative_utc=False | datetime.datetime(2022, 1, 11, 0, 0, 0, tzinfo=datetime.timezone.utc) | ||||
) | ) | ||||
def _create_release(author_fullname: Optional[str]) -> Dict: | def _create_release(author_fullname: Optional[str]) -> Dict: | ||||
"""Use Release.to_dict to be sure the field's name used to retrieve | """Use Release.to_dict to be sure the field's name used to retrieve | ||||
the author is correct""" | the author is correct""" | ||||
author = None | author = None | ||||
▲ Show 20 Lines • Show All 111 Lines • Show Last 20 Lines |