Commit 8344667d authored by zhanhuasheng's avatar zhanhuasheng

新增用例

parent ad6e5121
import pytest
from Utils import yaml_handler
from Utils import req_handler
from TestData.automation.robot_test_data import robotData
class TestRobot:
yaml_path = r'automation/robot.yaml'
yaml_data = yaml_handler.yaml_handler.get_case(yaml_path)
@pytest.mark.flaky(reruns=robotData.rerun, reruns_delay=robotData.rerun_delay)
@pytest.mark.parametrize('case',yaml_data)
def test_robot(self,case):
req_handler.ReqHandler.send_requests(case=case,var_class=robotData)
from Utils.global_variate import Global
from Utils.mockData_handler import data_handler
class robotData(Global):
robot_name = 'autotest_robot_name%s'%data_handler.random_id()
robot_icon = 'https://img.willdesk.com/test/avatar/6052/2024/05/20/4636f3223b79044c10c37d8ddf66ccfajpg图片Z64×64.jpg'
robot_origin_name = 'Chatbot'
robot_origin_icon = 'https://img.willdesk.com/test/avatar/6052/2024/05/20/6d406271b1dfae312e796f701dc44f9apng图片W1024×1024.png'
\ No newline at end of file
api1:
title: 更新robot信息
url: /api/v1/autoanswer/updateRobotInfo
method: post
data: {"brandId":"${brandId}","robotIcon":"${robot_icon}","robotName":"${robot_name}","v":"${v}"}
expected:
- eq: {"$.code":0}
api2:
title: 检查是否更新成功
url: /api/v1/autoanswer/robotInfo?v=${v}
method: get
expected:
- eq: {"$.code":0}
- eq: {"$.data.robotName":"${robot_name}"}
- eq: {"$.data.robotIcon":"${robot_icon}"}
- eq: {"$.data.brandId":"${brandId}"}
api3:
title: 恢复机器人信息
url: /api/v1/autoanswer/updateRobotInfo
method: post
data: {"brandId":"${brandId}","robotIcon":"${robot_origin_icon}","robotName":"${robot_origin_name}","v":"${v}"}
expected:
- eq: {"$.code":0}
api4:
title: 检查是否恢复
url: /api/v1/autoanswer/robotInfo?v=${v}
method: get
expected:
- eq: {"$.code":0}
- eq: {"$.data.robotName":"${robot_origin_name}"}
- eq: {"$.data.robotIcon":"${robot_origin_icon}"}
- eq: {"$.data.brandId":"${brandId}"}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment