Changeset View
Changeset View
Standalone View
Standalone View
swh/loader/package/deposit/tests/test_deposit.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 | ||||
import json | import json | ||||
import re | import re | ||||
from typing import List | from typing import List | ||||
import pytest | import pytest | ||||
from swh.core.pytest_plugin import requests_mock_datadir_factory | from swh.core.pytest_plugin import requests_mock_datadir_factory | ||||
from swh.loader.package.deposit.loader import ApiClient, DepositLoader | from swh.loader.package.deposit.loader import ApiClient, DepositLoader | ||||
from swh.loader.package.loader import now | from swh.loader.package.loader import now | ||||
from swh.loader.tests import assert_last_visit_matches, check_snapshot, get_stats | from swh.loader.tests import assert_last_visit_matches, check_snapshot, get_stats | ||||
from swh.model.hashutil import hash_to_bytes, hash_to_hex | from swh.model.hashutil import hash_to_bytes, hash_to_hex | ||||
from swh.model.identifiers import ( | |||||
CoreSWHID, | |||||
ExtendedObjectType, | |||||
ExtendedSWHID, | |||||
ObjectType, | |||||
) | |||||
from swh.model.model import ( | from swh.model.model import ( | ||||
MetadataAuthority, | MetadataAuthority, | ||||
MetadataAuthorityType, | MetadataAuthorityType, | ||||
MetadataFetcher, | MetadataFetcher, | ||||
Origin, | Origin, | ||||
RawExtrinsicMetadata, | RawExtrinsicMetadata, | ||||
Snapshot, | Snapshot, | ||||
SnapshotBranch, | SnapshotBranch, | ||||
TargetType, | TargetType, | ||||
) | ) | ||||
from swh.model.swhids import CoreSWHID, ExtendedObjectType, ExtendedSWHID, ObjectType | |||||
DEPOSIT_URL = "https://deposit.softwareheritage.org/1/private" | DEPOSIT_URL = "https://deposit.softwareheritage.org/1/private" | ||||
@pytest.fixture | @pytest.fixture | ||||
def requests_mock_datadir(requests_mock_datadir): | def requests_mock_datadir(requests_mock_datadir): | ||||
"""Enhance default mock data to mock put requests as the loader does some | """Enhance default mock data to mock put requests as the loader does some | ||||
internal update queries there. | internal update queries there. | ||||
▲ Show 20 Lines • Show All 419 Lines • Show Last 20 Lines |