88from unittest .mock import call , patch
99
1010import pytest
11+ from redis .credentials import UsernamePasswordCredentialProvider
12+
1113import redis
1214from redis import ConnectionPool , Redis
1315from redis ._parsers import _HiredisParser , _RESP2Parser , _RESP3Parser
@@ -441,6 +443,7 @@ def test_clears_cache_on_disconnect(self, mock_connection, cache_conf):
441443 mock_connection .retry = "mock"
442444 mock_connection .host = "mock"
443445 mock_connection .port = "mock"
446+ mock_connection .credential_provider = UsernamePasswordCredentialProvider ()
444447
445448 proxy_connection = CacheProxyConnection (
446449 mock_connection , cache , threading .Lock ()
@@ -457,6 +460,7 @@ def test_read_response_returns_cached_reply(self, mock_cache, mock_connection):
457460 mock_connection .retry = "mock"
458461 mock_connection .host = "mock"
459462 mock_connection .port = "mock"
463+ mock_connection .credential_provider = UsernamePasswordCredentialProvider ()
460464
461465 mock_cache .is_cachable .return_value = True
462466 mock_cache .get .side_effect = [
@@ -541,6 +545,7 @@ def test_triggers_invalidation_processing_on_another_connection(
541545 mock_connection .retry = "mock"
542546 mock_connection .host = "mock"
543547 mock_connection .port = "mock"
548+ mock_connection .credential_provider = UsernamePasswordCredentialProvider ()
544549
545550 another_conn = copy .deepcopy (mock_connection )
546551 another_conn .can_read .side_effect = [True , False ]
0 commit comments