test: set pool.provider= on mocks to avoid MagicMock truthy guard trigger

The provider-mismatch guard now checks pool_provider and
current_provider != pool_provider. MagicMock.provider returns
a truthy child mock by default, which would trigger the guard
and skip the pool recovery tests. Set pool.provider='' explicitly.
This commit is contained in:
isheng 2026-07-07 13:38:56 +08:00 committed by kshitij
parent 2e30a5e628
commit c2c73605e0
2 changed files with 6 additions and 0 deletions

View file

@ -155,6 +155,9 @@ class TestPoolRotationCycle:
pool = MagicMock()
pool.has_credentials.return_value = True
# Must be set explicitly — MagicMock.provider returns a truthy
# child mock, which would trigger the provider-mismatch guard.
pool.provider = ""
# mark_exhausted_and_rotate returns next entry until exhausted
self._rotation_index = 0

View file

@ -27,6 +27,9 @@ def _make_pool(entries):
pool = MagicMock()
pool.entries = entries
pool.current.return_value = entries[0]
# Must be set explicitly — MagicMock.provider returns a truthy
# child mock, which would trigger the provider-mismatch guard.
pool.provider = ""
return pool