Changeset View
Changeset View
Standalone View
Standalone View
swh/deposit/tests/loader/conftest.py
Show All 38 Lines | def swh_config(tmp_path, swh_storage_postgresql, monkeypatch): | ||||
conffile = os.path.join(tmp_path, "deposit.yml") | conffile = os.path.join(tmp_path, "deposit.yml") | ||||
with open(conffile, "w") as f: | with open(conffile, "w") as f: | ||||
f.write(yaml.dump(storage_config)) | f.write(yaml.dump(storage_config)) | ||||
monkeypatch.setenv("SWH_CONFIG_FILENAME", conffile) | monkeypatch.setenv("SWH_CONFIG_FILENAME", conffile) | ||||
return conffile | return conffile | ||||
@pytest.fixture | @pytest.fixture | ||||
def deposit_checker(swh_config): | def deposit_checker(): | ||||
return DepositChecker() | return DepositChecker( | ||||
config={ | |||||
"deposit": { | |||||
"url": "https://deposit.softwareheritage.org/1/private/", | |||||
"auth": {}, | |||||
} | |||||
} | |||||
) | |||||
@pytest.fixture | @pytest.fixture | ||||
def requests_mock_datadir(datadir, requests_mock_datadir): | def requests_mock_datadir(datadir, requests_mock_datadir): | ||||
"""Override default behavior to deal with put method | """Override default behavior to deal with put method | ||||
""" | """ | ||||
cb = partial(get_response_cb, datadir=datadir) | cb = partial(get_response_cb, datadir=datadir) | ||||
requests_mock_datadir.put(re.compile("https://"), body=cb) | requests_mock_datadir.put(re.compile("https://"), body=cb) | ||||
return requests_mock_datadir | return requests_mock_datadir |