Changeset View
Changeset View
Standalone View
Standalone View
swh/deposit/tests/loader/conftest.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 | ||||
from functools import partial | |||||
import re | |||||
import pytest | import pytest | ||||
from swh.core.pytest_plugin import get_response_cb | |||||
from swh.deposit.loader.checker import DepositChecker | from swh.deposit.loader.checker import DepositChecker | ||||
@pytest.fixture | @pytest.fixture | ||||
def deposit_config(tmp_path): | def deposit_config(tmp_path): | ||||
return { | return { | ||||
"deposit": { | "deposit": { | ||||
"url": "https://deposit.softwareheritage.org/1/private/", | "url": "https://deposit.softwareheritage.org/1/private/", | ||||
"auth": {}, | "auth": {}, | ||||
} | } | ||||
} | } | ||||
@pytest.fixture | @pytest.fixture | ||||
def deposit_checker(deposit_config_path): | def deposit_checker(deposit_config_path): | ||||
return DepositChecker() | return DepositChecker() | ||||
@pytest.fixture | |||||
def requests_mock_datadir(datadir, requests_mock_datadir): | |||||
"""Override default behavior to deal with put method | |||||
""" | |||||
cb = partial(get_response_cb, datadir=datadir) | |||||
requests_mock_datadir.put(re.compile("https://"), body=cb) | |||||
return requests_mock_datadir |