1
0
Fork 0
mirror of https://github.com/dragonflydb/dragonfly.git synced 2024-12-14 11:58:02 +00:00
dragonflydb-dragonfly/tests/fakeredis/test/test_mock.py
2024-08-22 22:30:42 +03:00

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