@@ -428,8 +428,10 @@ def test_clears_cache_on_disconnect(self, mock_connection, cache_conf):
428
428
429
429
cache .set (
430
430
CacheEntry (
431
- cache_key = cache_key , cache_value = b"bar" , status = CacheEntryStatus .VALID ,
432
- connection_ref = mock_connection
431
+ cache_key = cache_key ,
432
+ cache_value = b"bar" ,
433
+ status = CacheEntryStatus .VALID ,
434
+ connection_ref = mock_connection ,
433
435
)
434
436
)
435
437
assert cache .get (cache_key ).cache_value == b"bar"
@@ -439,7 +441,9 @@ def test_clears_cache_on_disconnect(self, mock_connection, cache_conf):
439
441
mock_connection .host = "mock"
440
442
mock_connection .port = "mock"
441
443
442
- proxy_connection = CacheProxyConnection (mock_connection , cache , threading .Lock ())
444
+ proxy_connection = CacheProxyConnection (
445
+ mock_connection , cache , threading .Lock ()
446
+ )
443
447
proxy_connection .disconnect ()
444
448
445
449
assert len (cache .get_collection ()) == 0
@@ -457,32 +461,34 @@ def test_read_response_returns_cached_reply(self, mock_cache, mock_connection):
457
461
cache_key = CacheKey (command = "GET" , redis_keys = ("foo" ,)),
458
462
cache_value = CacheProxyConnection .DUMMY_CACHE_VALUE ,
459
463
status = CacheEntryStatus .IN_PROGRESS ,
460
- connection_ref = mock_connection
464
+ connection_ref = mock_connection ,
461
465
),
462
466
CacheEntry (
463
467
cache_key = CacheKey (command = "GET" , redis_keys = ("foo" ,)),
464
468
cache_value = b"bar" ,
465
469
status = CacheEntryStatus .VALID ,
466
- connection_ref = mock_connection
470
+ connection_ref = mock_connection ,
467
471
),
468
472
CacheEntry (
469
473
cache_key = CacheKey (command = "GET" , redis_keys = ("foo" ,)),
470
474
cache_value = b"bar" ,
471
475
status = CacheEntryStatus .VALID ,
472
- connection_ref = mock_connection
476
+ connection_ref = mock_connection ,
473
477
),
474
478
CacheEntry (
475
479
cache_key = CacheKey (command = "GET" , redis_keys = ("foo" ,)),
476
480
cache_value = b"bar" ,
477
481
status = CacheEntryStatus .VALID ,
478
- connection_ref = mock_connection
482
+ connection_ref = mock_connection ,
479
483
),
480
484
]
481
485
mock_connection .send_command .return_value = Any
482
486
mock_connection .read_response .return_value = b"bar"
483
487
mock_connection .can_read .return_value = False
484
488
485
- proxy_connection = CacheProxyConnection (mock_connection , mock_cache , threading .Lock ())
489
+ proxy_connection = CacheProxyConnection (
490
+ mock_connection , mock_cache , threading .Lock ()
491
+ )
486
492
proxy_connection .send_command (* ["GET" , "foo" ], ** {"keys" : ["foo" ]})
487
493
assert proxy_connection .read_response () == b"bar"
488
494
assert proxy_connection .read_response () == b"bar"
@@ -495,15 +501,15 @@ def test_read_response_returns_cached_reply(self, mock_cache, mock_connection):
495
501
cache_key = CacheKey (command = "GET" , redis_keys = ("foo" ,)),
496
502
cache_value = CacheProxyConnection .DUMMY_CACHE_VALUE ,
497
503
status = CacheEntryStatus .IN_PROGRESS ,
498
- connection_ref = mock_connection
504
+ connection_ref = mock_connection ,
499
505
)
500
506
),
501
507
call (
502
508
CacheEntry (
503
509
cache_key = CacheKey (command = "GET" , redis_keys = ("foo" ,)),
504
510
cache_value = b"bar" ,
505
511
status = CacheEntryStatus .VALID ,
506
- connection_ref = mock_connection
512
+ connection_ref = mock_connection ,
507
513
)
508
514
),
509
515
]
0 commit comments