Changeset View
Changeset View
Standalone View
Standalone View
swh/objstorage/tests/test_server.py
# Copyright (C) 2019 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 copy | import copy | ||||
import pytest | import pytest | ||||
import yaml | import yaml | ||||
▲ Show 20 Lines • Show All 98 Lines • ▼ Show 20 Lines | [ | ||||
), | ), | ||||
], | ], | ||||
) | ) | ||||
def test_load_and_check_config(tmpdir, config): | def test_load_and_check_config(tmpdir, config): | ||||
"""pathslicing configuration fine loads ok""" | """pathslicing configuration fine loads ok""" | ||||
config_path = prepare_config_file(tmpdir, config) | config_path = prepare_config_file(tmpdir, config) | ||||
cfg = load_and_check_config(config_path) | cfg = load_and_check_config(config_path) | ||||
assert cfg == config | assert cfg == config | ||||
@pytest.mark.parametrize( | |||||
"config", [pytest.param({"objstorage": {"cls": "noop",}}, id="noop",),], | |||||
) | |||||
def test_load_and_check_config_raise(tmpdir, config): | |||||
"""pathslicing configuration fine loads ok""" | |||||
config_path = prepare_config_file(tmpdir, config) | |||||
with pytest.raises(EnvironmentError, match="not be used in production"): | |||||
load_and_check_config(config_path) |