Skip to content

Commit cdf8504

Browse files
committed
Fixed additional broken tests
1 parent 98bf72d commit cdf8504

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

tests/test_connection.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,8 @@ def test_clears_cache_on_disconnect(self, mock_connection, cache_conf):
428428

429429
cache.set(
430430
CacheEntry(
431-
cache_key=cache_key, cache_value=b"bar", status=CacheEntryStatus.VALID
431+
cache_key=cache_key, cache_value=b"bar", status=CacheEntryStatus.VALID,
432+
connection_ref=mock_connection
432433
)
433434
)
434435
assert cache.get(cache_key).cache_value == b"bar"
@@ -438,7 +439,7 @@ def test_clears_cache_on_disconnect(self, mock_connection, cache_conf):
438439
mock_connection.host = "mock"
439440
mock_connection.port = "mock"
440441

441-
proxy_connection = CacheProxyConnection(mock_connection, cache)
442+
proxy_connection = CacheProxyConnection(mock_connection, cache, threading.Lock())
442443
proxy_connection.disconnect()
443444

444445
assert len(cache.get_collection()) == 0
@@ -456,28 +457,32 @@ def test_read_response_returns_cached_reply(self, mock_cache, mock_connection):
456457
cache_key=CacheKey(command="GET", redis_keys=("foo",)),
457458
cache_value=CacheProxyConnection.DUMMY_CACHE_VALUE,
458459
status=CacheEntryStatus.IN_PROGRESS,
460+
connection_ref=mock_connection
459461
),
460462
CacheEntry(
461463
cache_key=CacheKey(command="GET", redis_keys=("foo",)),
462464
cache_value=b"bar",
463465
status=CacheEntryStatus.VALID,
466+
connection_ref=mock_connection
464467
),
465468
CacheEntry(
466469
cache_key=CacheKey(command="GET", redis_keys=("foo",)),
467470
cache_value=b"bar",
468471
status=CacheEntryStatus.VALID,
472+
connection_ref=mock_connection
469473
),
470474
CacheEntry(
471475
cache_key=CacheKey(command="GET", redis_keys=("foo",)),
472476
cache_value=b"bar",
473477
status=CacheEntryStatus.VALID,
478+
connection_ref=mock_connection
474479
),
475480
]
476481
mock_connection.send_command.return_value = Any
477482
mock_connection.read_response.return_value = b"bar"
478483
mock_connection.can_read.return_value = False
479484

480-
proxy_connection = CacheProxyConnection(mock_connection, mock_cache)
485+
proxy_connection = CacheProxyConnection(mock_connection, mock_cache, threading.Lock())
481486
proxy_connection.send_command(*["GET", "foo"], **{"keys": ["foo"]})
482487
assert proxy_connection.read_response() == b"bar"
483488
assert proxy_connection.read_response() == b"bar"
@@ -490,13 +495,15 @@ def test_read_response_returns_cached_reply(self, mock_cache, mock_connection):
490495
cache_key=CacheKey(command="GET", redis_keys=("foo",)),
491496
cache_value=CacheProxyConnection.DUMMY_CACHE_VALUE,
492497
status=CacheEntryStatus.IN_PROGRESS,
498+
connection_ref=mock_connection
493499
)
494500
),
495501
call(
496502
CacheEntry(
497503
cache_key=CacheKey(command="GET", redis_keys=("foo",)),
498504
cache_value=b"bar",
499505
status=CacheEntryStatus.VALID,
506+
connection_ref=mock_connection
500507
)
501508
),
502509
]

0 commit comments

Comments
 (0)