瀏覽代碼

[update] testDbClient.py

jhao 6 年之前
父節點
當前提交
8074dfa84f
共有 2 個文件被更改,包括 48 次插入0 次删除
  1. 35 0
      Test/testDbClient.py
  2. 13 0
      test/testDbClient.py

+ 35 - 0
Test/testDbClient.py

@@ -0,0 +1,35 @@
+# -*- coding: utf-8 -*-
+"""
+-------------------------------------------------
+   File Name:     testDbClient
+   Description :
+   Author :        JHao
+   date:          2020/6/23
+-------------------------------------------------
+   Change Activity:
+                   2020/6/23:
+-------------------------------------------------
+"""
+__author__ = 'JHao'
+
+from proxyDB.DbClient import DbClient
+
+if __name__ == '__main__':
+    #  ############### ssdb ###############
+    ssdb_uri = "ssdb://:password@127.0.0.1:8888"
+    s = DbClient.parseDbConn(ssdb_uri)
+    assert s.db_type == "SSDB"
+    assert s.db_pwd == "password"
+    assert s.db_host == "127.0.0.1"
+    assert s.db_port == 8888
+
+    #  ############### redis ###############
+    redis_uri = "redis://:password@127.0.0.1:6379/1"
+    r = DbClient.parseDbConn(redis_uri)
+    assert r.db_type == "REDIS"
+    assert r.db_pwd == "password"
+    assert r.db_host == "127.0.0.1"
+    assert r.db_port == 6379
+    assert r.db_name == "1"
+
+    print("DbClient ok!")

+ 13 - 0
test/testDbClient.py

@@ -0,0 +1,13 @@
+# -*- coding: utf-8 -*-
+"""
+-------------------------------------------------
+   File Name:     testDbClient
+   Description :
+   Author :        JHao
+   date:          2020/6/23
+-------------------------------------------------
+   Change Activity:
+                   2020/6/23:
+-------------------------------------------------
+"""
+__author__ = 'JHao'