We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d4a9cda commit 05cff79Copy full SHA for 05cff79
test/test_redis_connect_host.py
@@ -0,0 +1,27 @@
1
+import os
2
+import sys
3
+
4
+if sys.version_info.major == 3:
5
+ from unittest import mock
6
+else:
7
+ import mock
8
9
+modules_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
10
+sys.path.insert(0, os.path.join(modules_path, 'src'))
11
12
+from swsssdk import SonicV2Connector
13
14
+def test_redis_connect_host():
15
+ mock_dbintf = mock.MagicMock()
16
+ db = SonicV2Connector()
17
+ db.dbintf = mock_dbintf
18
+ db.dbintf.redis_kwargs = {}
19
20
+ db_name = 'COUNTERS_DB'
21
+ host = '127.0.0.1'
22
23
+ db.connect_host(db_name, host)
24
+ mock_dbintf.connect.assert_called_once_with(2, db_name, True)
25
26
+ assert db.dbintf.redis_kwargs["host"] == host
27
+ assert db.dbintf.redis_kwargs["port"] == 6379
0 commit comments