Changeset View
Changeset View
Standalone View
Standalone View
swh/loader/package/debian/tests/test_debian.py
# Copyright (C) 2019-2021 The Software Heritage developers | # Copyright (C) 2019-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 | ||||
from copy import deepcopy | from copy import deepcopy | ||||
import datetime | |||||
import hashlib | import hashlib | ||||
import logging | import logging | ||||
from os import path | from os import path | ||||
import pytest | import pytest | ||||
import requests | import requests | ||||
from swh.loader.package.debian.loader import ( | from swh.loader.package.debian.loader import ( | ||||
Show All 12 Lines | |||||
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, | ||||
Snapshot, | Snapshot, | ||||
SnapshotBranch, | SnapshotBranch, | ||||
TargetType, | TargetType, | ||||
Timestamp, | |||||
TimestampWithTimezone, | TimestampWithTimezone, | ||||
) | ) | ||||
logger = logging.getLogger(__name__) | logger = logging.getLogger(__name__) | ||||
URL = "deb://Debian/packages/cicero" | URL = "deb://Debian/packages/cicero" | ||||
▲ Show 20 Lines • Show All 106 Lines • ▼ Show 20 Lines | assert swh_storage.release_get([release_id])[0] == Release( | ||||
target=hash_to_bytes("798df511408c53bf842a8e54d4d335537836bdc3"), | target=hash_to_bytes("798df511408c53bf842a8e54d4d335537836bdc3"), | ||||
target_type=ObjectType.DIRECTORY, | target_type=ObjectType.DIRECTORY, | ||||
synthetic=True, | synthetic=True, | ||||
author=Person( | author=Person( | ||||
fullname=b"Samuel Thibault <sthibault@debian.org>", | fullname=b"Samuel Thibault <sthibault@debian.org>", | ||||
name=b"Samuel Thibault", | name=b"Samuel Thibault", | ||||
email=b"sthibault@debian.org", | email=b"sthibault@debian.org", | ||||
), | ), | ||||
date=TimestampWithTimezone( | date=TimestampWithTimezone.from_datetime( | ||||
timestamp=Timestamp(seconds=1413730355, microseconds=0), | datetime.datetime( | ||||
offset=120, | 2014, | ||||
negative_utc=False, | 10, | ||||
19, | |||||
16, | |||||
52, | |||||
35, | |||||
tzinfo=datetime.timezone(datetime.timedelta(seconds=7200)), | |||||
) | |||||
), | ), | ||||
) | ) | ||||
stats = get_stats(swh_storage) | stats = get_stats(swh_storage) | ||||
assert { | assert { | ||||
"content": 42, | "content": 42, | ||||
"directory": 2, | "directory": 2, | ||||
"origin": 1, | "origin": 1, | ||||
▲ Show 20 Lines • Show All 367 Lines • Show Last 20 Lines |