def test_check_config_not_local() -> None:
"""Wrong configuration raises"""
expected_error = (
"The vault backend can only be started with a 'local' configuration"
)
with pytest.raises(EnvironmentError, match=expected_error):
> check_config({"vault": {"cls": "remote"}})
.tox/py3/lib/python3.7/site-packages/swh/vault/tests/test_server.py:166:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cfg = {'vault': {'cls': 'remote'}}
def check_config(cfg: Dict[str, Any]) -> Dict[str, Any]:
"""Ensure the configuration is ok to run a postgresql vault server, and propagate
defaults.
Raises:
EnvironmentError if the configuration is not for postgresql instance
ValueError if one of the following keys is missing: vault, cache, storage,
scheduler
Returns:
New configuration dict to instantiate a postgresql vault server instance.
"""
cfg = cfg.copy()
if "vault" not in cfg:
raise ValueError("missing 'vault' configuration")
vcfg = cfg["vault"]
if vcfg["cls"] not in ("local", "postgresql"):
raise EnvironmentError(
> "The vault backend can only be started with a 'postgresql' configuration",
)
E OSError: The vault backend can only be started with a 'postgresql' configuration
.tox/py3/lib/python3.7/site-packages/swh/vault/api/server.py:84: OSError
During handling of the above exception, another exception occurred:
def test_check_config_not_local() -> None:
"""Wrong configuration raises"""
expected_error = (
"The vault backend can only be started with a 'local' configuration"
)
with pytest.raises(EnvironmentError, match=expected_error):
> check_config({"vault": {"cls": "remote"}})
E AssertionError: Regex pattern "The vault backend can only be started with a 'local' configuration" does not match "The vault backend can only be started with a 'postgresql' configuration".
.tox/py3/lib/python3.7/site-packages/swh/vault/tests/test_server.py:166: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Jul 29 2022, 10:07 AM