config_ok = {'storage': {'cls': 'remote', 'url': 'mock://storage-url'}, 'vault': {'cls': 'remote', 'url': 'mock://vault-backend'}}
tmp_path = PosixPath('/tmp/pytest-of-jenkins/pytest-0/test_get_cooker_nominal_config2')
monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7f1d2dbd7d68>
@pytest.mark.parametrize(
"config_ok",
[
{
"vault": {
"cls": "remote",
"args": {
"url": "mock://vault-backend",
"storage": {"cls": "remote", "url": "mock://storage-url"},
},
}
},
{
"vault": {"cls": "remote", "args": {"url": "mock://vault-backend",},},
"storage": {"cls": "remote", "url": "mock://storage-url"},
},
{
"vault": {"cls": "remote", "url": "mock://vault-backend",},
"storage": {"cls": "remote", "url": "mock://storage-url"},
},
],
)
def test_get_cooker_nominal(config_ok, tmp_path, monkeypatch):
"""Correct configuration should allow the instantiation of the cookers
"""
for cooker_type in COOKER_TYPES.keys():
write_config_to_env(config_ok, tmp_path, monkeypatch)
> cooker = get_cooker(cooker_type, TEST_HEX_ID)
.tox/py3/lib/python3.7/site-packages/swh/vault/tests/test_init_cookers.py:109:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj_type = 'directory', obj_id = '4a4b9771542143cf070386f86b4b92d42966bdbc'
def get_cooker(obj_type: str, obj_id: str):
"""Instantiate a cooker class of type obj_type.
Returns:
Cooker class in charge of cooking the obj_type with id obj_id.
Raises:
ValueError in case of a missing top-level vault key configuration or a storage
key.
EnvironmentError in case the vault configuration reference a non remote class.
"""
if "SWH_CONFIG_FILENAME" in os.environ:
cfg = read_config(os.environ["SWH_CONFIG_FILENAME"], DEFAULT_CONFIG)
else:
cfg = load_named_config(DEFAULT_CONFIG_PATH, DEFAULT_CONFIG)
cooker_cls = get_cooker_cls(obj_type)
if "vault" not in cfg:
raise ValueError("missing 'vault' configuration")
vcfg = cfg["vault"]
if vcfg["cls"] != "remote":
raise EnvironmentError(
"This vault backend can only be a 'remote' configuration"
)
> args = {**vcfg, **vcfg.get("args")}
E TypeError: 'NoneType' object is not a mapping
.tox/py3/lib/python3.7/site-packages/swh/vault/cookers/__init__.py:53: TypeError
TEST RESULT
TEST RESULT
- Run At
- Oct 23 2020, 6:57 PM