mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2024-12-14 11:58:02 +00:00
e3016a6f83
* fakeredis tests
16 lines
390 B
Python
16 lines
390 B
Python
from unittest.mock import patch
|
|
|
|
import redis
|
|
from fakeredis import FakeRedis
|
|
|
|
|
|
def test_mock():
|
|
# Mock Redis connection
|
|
def bar(redis_host: str, redis_port: int):
|
|
redis.Redis(redis_host, redis_port)
|
|
|
|
with patch("redis.Redis", FakeRedis):
|
|
# Call function
|
|
bar("localhost", 6000)
|
|
|
|
# Related to #36 - this should fail if mocking Redis does not work
|