File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -58,6 +58,10 @@ def __init__(self,
5858 # Dictionary from script to sha ''Script''
5959 self .shas = dict ()
6060
61+ @classmethod
62+ def from_url (cls , url , db = None , ** kwargs ):
63+ return cls (** kwargs )
64+
6165 # Connection Functions #
6266
6367 def echo (self , msg ):
@@ -1509,6 +1513,8 @@ def mock_redis_client(**kwargs):
15091513 """
15101514 return MockRedis ()
15111515
1516+ mock_redis_client .from_url = mock_redis_client
1517+
15121518
15131519def mock_strict_redis_client (** kwargs ):
15141520 """
@@ -1517,3 +1523,5 @@ def mock_strict_redis_client(**kwargs):
15171523 instead of a StrictRedis object.
15181524 """
15191525 return MockRedis (strict = True )
1526+
1527+ mock_strict_redis_client .from_url = mock_strict_redis_client
Original file line number Diff line number Diff line change @@ -13,8 +13,22 @@ def test_mock_redis_client():
1313 ok_ (not mock_redis_client (host = "localhost" , port = 6379 ).strict )
1414
1515
16+ def test_mock_redis_client_from_url ():
17+ """
18+ Test that we can pass kwargs to the Redis from_url mock/patch target.
19+ """
20+ ok_ (not mock_redis_client .from_url (host = "localhost" , port = 6379 ).strict )
21+
22+
1623def test_mock_strict_redis_client ():
1724 """
1825 Test that we can pass kwargs to the StrictRedis mock/patch target.
1926 """
2027 ok_ (mock_strict_redis_client (host = "localhost" , port = 6379 ).strict )
28+
29+
30+ def test_mock_strict_redis_client_from_url ():
31+ """
32+ Test that we can pass kwargs to the StrictRedis from_url mock/patch target.
33+ """
34+ ok_ (mock_strict_redis_client .from_url (host = "localhost" , port = 6379 ).strict )
You can’t perform that action at this time.
0 commit comments