fix: mount retry adapter on Redmine engine session

python-redmine exposes  as a context manager, while the
actual requests.Session lives in . Mounting the
retry adapter on the wrong object caused:

    'function' object has no attribute 'mount'

on startup. Update the related test to mock the real session.
This commit is contained in:
Кокос Артем Николаевич
2026-06-29 11:53:09 +07:00
parent 58fa5a7ab4
commit 738d9d543e
2 changed files with 9 additions and 14 deletions

View File

@@ -196,16 +196,14 @@ def test_fetch_mounts_retry_adapter(mock_redmine_class):
fetch_issues_with_spent_time("2026-01-01", "2026-01-31")
# Проверяем, что session.mount был вызван для http:// и https://
mount_calls = mock_redmine.session.mount.call_args_list
# Проверяем, что engine.session.mount был вызван для http:// и https://
mount_calls = mock_redmine.engine.session.mount.call_args_list
prefixes = [call.args[0] for call in mount_calls]
assert "https://" in prefixes
assert "http://" in prefixes
# Проверяем retry-конфигурацию адаптера
https_adapter = next(
call.args[1] for call in mount_calls if call.args[0] == "https://"
)
https_adapter = next(call.args[1] for call in mount_calls if call.args[0] == "https://")
max_retries = https_adapter.max_retries
assert max_retries.total == 3
assert 429 in max_retries.status_forcelist