|
3 | 3 | """
|
4 | 4 |
|
5 | 5 | import pytest
|
6 |
| -from unittest.mock import Mock, patch, MagicMock |
7 |
| -import redis |
8 |
| -from redis.cluster import RedisCluster |
9 |
| -from redis.exceptions import ConnectionError, TimeoutError, RedisError |
| 6 | +from unittest.mock import Mock, patch |
| 7 | +from redis.exceptions import ConnectionError |
10 | 8 |
|
11 | 9 | from src.common.connection import RedisConnectionManager
|
12 | 10 |
|
@@ -153,6 +151,7 @@ def test_get_connection_with_decode_responses_false(self, mock_config, mock_redi
|
153 | 151 | mock_redis_class.return_value = mock_redis_instance
|
154 | 152 |
|
155 | 153 | connection = RedisConnectionManager.get_connection(decode_responses=False)
|
| 154 | + assert connection == mock_redis_instance |
156 | 155 |
|
157 | 156 | call_args = mock_redis_class.call_args[1]
|
158 | 157 | assert call_args["decode_responses"] is False
|
@@ -180,6 +179,7 @@ def test_get_connection_with_ssl_configuration(self, mock_config, mock_redis_cla
|
180 | 179 | mock_redis_class.return_value = mock_redis_instance
|
181 | 180 |
|
182 | 181 | connection = RedisConnectionManager.get_connection()
|
| 182 | + assert connection == mock_redis_instance |
183 | 183 |
|
184 | 184 | call_args = mock_redis_class.call_args[1]
|
185 | 185 | assert call_args["ssl"] is True
|
@@ -213,6 +213,8 @@ def test_get_connection_includes_version_in_lib_name(self, mock_config, mock_red
|
213 | 213 |
|
214 | 214 | with patch('src.common.connection.__version__', '1.0.0'):
|
215 | 215 | connection = RedisConnectionManager.get_connection()
|
| 216 | + |
| 217 | + assert connection == mock_redis_instance |
216 | 218 |
|
217 | 219 | call_args = mock_redis_class.call_args[1]
|
218 | 220 | assert "redis-py(mcp-server_v1.0.0)" in call_args["lib_name"]
|
@@ -304,6 +306,8 @@ def test_connection_parameters_filtering(self, mock_config, mock_redis_class):
|
304 | 306 | mock_redis_class.return_value = mock_redis_instance
|
305 | 307 |
|
306 | 308 | connection = RedisConnectionManager.get_connection()
|
| 309 | + |
| 310 | + assert connection == mock_redis_instance |
307 | 311 |
|
308 | 312 | call_args = mock_redis_class.call_args[1]
|
309 | 313 | assert call_args["username"] is None
|
|
0 commit comments