浏览代码

聊天内容保存、未读消息总量

liuyali@topnet.net.cn 1 周之前
父节点
当前提交
b4d3d95d16
共有 3 个文件被更改,包括 79 次插入3 次删除
  1. 26 0
      cases/pc/登录功能/在线客服/message_add.py
  2. 26 0
      cases/pc/登录功能/在线客服/message_count.py
  3. 27 3
      lib/webapi.py

+ 26 - 0
cases/pc/登录功能/在线客服/message_add.py

@@ -0,0 +1,26 @@
+from hytest import *
+from lib.webapi import apimgr
+class c1:
+    name = '聊天内容保存'
+    def setup(self):
+        INFO('切换用户身份到质量部测试企业下')
+        apimgr.Identity_list(0)
+        apimgr.Identity_switch()
+
+    def teardown(self):
+        INFO('将用户切回到闫培珠新版商机管理企业')
+        apimgr.Identity_list(1)
+        apimgr.Identity_switch()
+    def teststeps(self):
+        INFO('测试步骤')
+        STEP(1, '第一步调用函数')
+        res = apimgr.message_add()
+        actual = res.json()
+        #INFO(actual)
+        error_code = actual["error_code"]
+        content = actual["data"]["content"]
+        STEP(2, '第二步设置检查点')
+        # 设置检查点
+        CHECK_POINT('检查聊天内容保存-人工客服跟用户聊天接口是否正常',error_code == 0 and content =="我是剑鱼标讯人工客服,请问有什么可以帮助您的?")
+
+

+ 26 - 0
cases/pc/登录功能/在线客服/message_count.py

@@ -0,0 +1,26 @@
+from hytest import *
+from lib.webapi import apimgr
+class c1:
+    name = '未读消息总量'
+    def setup(self):
+        INFO('切换用户身份到质量部测试企业下')
+        apimgr.Identity_list(0)
+        apimgr.Identity_switch()
+
+    def teardown(self):
+        INFO('将用户切回到闫培珠新版商机管理企业')
+        apimgr.Identity_list(1)
+        apimgr.Identity_switch()
+    def teststeps(self):
+        INFO('测试步骤')
+        STEP(1, '第一步调用函数')
+        res = apimgr.message_count()
+        actual = res.json()
+        #INFO(actual)
+        error_code = actual["error_code"]
+        count = actual["count"]
+        STEP(2, '第二步设置检查点')
+        # 设置检查点
+        CHECK_POINT('检查未读消息总量接口是否正常',error_code == 0 and count >= 0)
+
+

+ 27 - 3
lib/webapi.py

@@ -1,8 +1,8 @@
 import json
 import requests
 from hytest.common import *
-#from pandas.io.formats.style import properties_args
-#from sympy.physics.vector.printing import params
+from pandas.io.formats.style import properties_args
+from sympy.physics.vector.printing import params
 
 from cfg import cfg
 from bs4 import BeautifulSoup
@@ -2167,7 +2167,31 @@ class APIMgr():
         headers = GSTORE['headers']
         response = self.s.post(f"{cfg.target_host_app}/jyapi/jybx/subscribe/vType/someInfo", headers=headers)
         return response
-
+    #聊天内容保存-人工客服跟用户聊天
+    def message_add(self):
+        headers = GSTORE['headers']
+        json = {
+                "receiveId": "4759445955430b",
+                "sendId": "475b435a5c440b09",
+                "ownType": 2,
+                "title": "文本",
+                "item": 8,
+                "itemType": 5,
+                "link": "",
+                "fool": 1,
+                "type": 1,
+                "content": "我是剑鱼标讯人工客服,请问有什么可以帮助您的?"
+            }
+        response = self.s.post(f"{cfg.target_host}/jyapi/message/messageAdd", headers=headers , json=json)
+        return response
+    #未读消息总量
+    def message_count(self):
+        headers = GSTORE['headers']
+        json = {
+            "userType": 1
+        }
+        response = self.s.post(f"{cfg.target_host}/jyapi/message/messageCount", headers=headers, json=json)
+        return response