zangyamei 2 сар өмнө
parent
commit
ef34e558b4

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

@@ -0,0 +1,16 @@
+from hytest import *
+from lib.webapi import apimgr
+import json
+
+class c1:
+    name = '根据问题查询答案'
+
+    def teststeps(self):
+        INFO('初始化方法')
+        STEP(1, '第一步调用函数')
+        res = apimgr.findanswer() #调用了apimgr对象的findanswer()方法,并将返回结果存储在变量res中
+        resp = res.json() #res是一个HTTP响应对象,使用.json()方法将其内容解析为JSON格式。然后将解析后的结果赋值给变量resp
+        error_code = resp['error_code'] #从resp字典中提取出error_code字段的值。通常,error_code用于表示操作的结果状态
+        STEP(2, '第二步设置检查点')
+        # 设置检查点
+        CHECK_POINT('检查接口是否正常', error_code==0)

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

@@ -0,0 +1,16 @@
+from hytest import *
+from lib.webapi import apimgr
+import json
+
+class c1:
+    name = '用户端-猜你想问'
+
+    def teststeps(self):
+        INFO('初始化方法')
+        STEP(1, '第一步调用函数')
+        res = apimgr.guesstoask() #调用了apimgr对象的guesstoask()方法,并将返回结果存储在变量res中
+        resp = res.json() #res是一个HTTP响应对象,使用.json()方法将其内容解析为JSON格式。然后将解析后的结果赋值给变量resp
+        error_code = resp['error_code'] #从resp字典中提取出error_code字段的值。通常,error_code用于表示操作的结果状态
+        STEP(2, '第二步设置检查点')
+        # 设置检查点
+        CHECK_POINT('检查接口是否正常', error_code==0)

+ 19 - 0
lib/webapi.py

@@ -1923,6 +1923,25 @@ class APIMgr():
         response = self.s.post(f"{cfg.target_host}/jyapi/message/closeChatSession", headers=headers, json=json)
         return response
 
+    #根据问题查询答案
+    def findanswer(self):
+        headers = GSTORE['headers']
+        json = {"question":"标书制作",
+                "type":1,
+                "robotEntId":"455b425f"}
+        response = self.s.post(f"{cfg.target_host}/jyapi/knowledge/findAnswer",headers = headers ,json = json)
+        return response
+
+    #用户端-猜你想问
+    def guesstoask(self):
+        headers = GSTORE['headers']
+        json = {"question":"大会员",
+                "type":1,
+                "entId":"455b425f",
+                "reqSource":1
+}
+        response = self.s.post(f"{cfg.target_host}/jyapi/knowledge/guessToAsk",headers = headers ,json = json)
+        return response
 
 
 apimgr = APIMgr()