fix: verify_ssl: true in YAML now uses DEFAULT_REDMINE_VERIFY path

Previously boolean True was passed directly to python-redmine
which used system CA bundle instead of the project's default CA file.
Now 'true' in YAML maps to DEFAULT_REDMINE_VERIFY path.
This commit is contained in:
Кокос Артем Николаевич
2026-07-03 18:24:11 +07:00
parent 0fa4e271a7
commit 67350bfcd6
2 changed files with 22 additions and 2 deletions

View File

@@ -139,13 +139,13 @@ class AppConfig:
if value is None:
return DEFAULT_REDMINE_VERIFY
if isinstance(value, bool):
return value
return DEFAULT_REDMINE_VERIFY if value else False
if isinstance(value, str):
normalized = value.lower()
if normalized in FALSE_VALUES:
return False
if normalized in TRUE_VALUES:
return True
return DEFAULT_REDMINE_VERIFY
return resolve_env_vars(value)
return DEFAULT_REDMINE_VERIFY

View File

@@ -247,6 +247,26 @@ class TestAppConfigFromYaml:
assert cfg.redmine_api_key == "secret-token"
def test_verify_ssl_true_returns_default_ca_path(self):
"""verify_ssl: true → DEFAULT_REDMINE_VERIFY (путь), не Python True."""
with tempfile.TemporaryDirectory() as tmp:
yaml_path = Path(tmp) / "config.yml"
yaml_path.write_text("redmine:\n verify_ssl: true\n")
cfg = AppConfig.from_yaml(yaml_path)
assert cfg.redmine_verify == DEFAULT_REDMINE_VERIFY
assert cfg.redmine_verify is not True # не бул!
def test_verify_ssl_false_returns_false(self):
with tempfile.TemporaryDirectory() as tmp:
yaml_path = Path(tmp) / "config.yml"
yaml_path.write_text("redmine:\n verify_ssl: false\n")
cfg = AppConfig.from_yaml(yaml_path)
assert cfg.redmine_verify is False
def test_missing_env_var_logs_warning(self, caplog):
import logging