diff --git a/TestCase/automation/test_02_robot.py b/TestCase/automation/test_02_robot.py new file mode 100644 index 0000000000000000000000000000000000000000..cfe6f3f2f2abea0b7a8d560d5ee8b807a5dc6751 --- /dev/null +++ b/TestCase/automation/test_02_robot.py @@ -0,0 +1,13 @@ +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) diff --git a/TestData/automation/robot_test_data.py b/TestData/automation/robot_test_data.py new file mode 100644 index 0000000000000000000000000000000000000000..61408fb4203e6883f9e07622f006044fc7fb8948 --- /dev/null +++ b/TestData/automation/robot_test_data.py @@ -0,0 +1,8 @@ +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 diff --git a/YamlCase/automation/robot.yaml b/YamlCase/automation/robot.yaml new file mode 100644 index 0000000000000000000000000000000000000000..6d6d42b0fbef8e516c46c79775827306feb5ca60 --- /dev/null +++ b/YamlCase/automation/robot.yaml @@ -0,0 +1,35 @@ +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}"}