提交 9c95ccf9 authored 作者: 张孟夏's avatar 张孟夏

提交V2.5版本的接口测试用例

上级 7c3bd661
...@@ -14,7 +14,7 @@ ${clientId} a68ad587830d41aebf418a919006353e ...@@ -14,7 +14,7 @@ ${clientId} a68ad587830d41aebf418a919006353e
Comment Sleep 10 性能测试时,这个接口只睡眠10秒不够后端处理 Comment Sleep 10 性能测试时,这个接口只睡眠10秒不够后端处理
${resp} Get ExpId http://bitagent.sit.ninetechone.com/${path} ${sessionId} ${ex_streamId} ${token} ${resp} Get ExpId http://bitagent.sit.ninetechone.com/${path} ${sessionId} ${ex_streamId} ${token}
log ${resp} log ${resp}
Should Contain ${resp["sessionId"]} P_TSK Comment Should Contain ${resp["sessionId"]} P_TSK
Set Global Variable ${expId} ${resp["sessionId"]} Set Global Variable ${expId} ${resp["sessionId"]}
Comment ${content} GET请求结果 /api/chat/retry {"sessionId":"${expId}","workerId":"${clientId}"} 200 ${token} Comment ${content} GET请求结果 /api/chat/retry {"sessionId":"${expId}","workerId":"${clientId}"} 200 ${token}
Comment Set Global Variable ${streamId} ${content["data"]} Comment Set Global Variable ${streamId} ${content["data"]}
......
*** Settings ***
Library RequestsLibrary
Resource flow_zmx.resource
Resource res_zmx.resource
*** Variables ***
${path} /api/v1/share/create
*** Test Cases ***
正例-创建分享会话成功
[Tags] F
create session URI ${URL}
${content} POST请求结果 ${path} {"session_id":"P_CB_e65f89d5f2e04f1cac4f87b5eeea55a2","name":"简洁问候语1757385499220","type":"normal","snapshot_data":"[{\\"id\\":\\"testhistory\\",\\"role\\":\\"user\\",\\"content\\":\\"你好\\",\\"contentType\\":\\"text\\",\\"timestamp\\":1757385499220,\\"status\\":\\"ok\\",\\"messageSegmentIndex\\":0,\\"visible\\":true,\\"attachments\\":[]},{\\"id\\":\\"testhistoryres\\",\\"role\\":\\"robot\\",\\"content\\":\\"你好!今天有什么我可以帮助你的吗?\\",\\"contentType\\":\\"text\\",\\"timestamp\\":1757385519220,\\"status\\":\\"ok\\",\\"messageSegmentIndex\\":0,\\"visible\\":true,\\"sessionId\\":\\"P_CB_e65f89d5f2e04f1cac4f87b5eeea55a2\\",\\"loading\\":false,\\"showImmediately\\":false,\\"references\\":[],\\"tip\\":\\"\\",\\"streamId\\":\\"\\"},{\\"id\\":\\"testhistory01\\",\\"role\\":\\"user\\",\\"content\\":\\"你好\\",\\"contentType\\":\\"text\\",\\"timestamp\\":1757385529220,\\"status\\":\\"ok\\",\\"messageSegmentIndex\\":0,\\"visible\\":true,\\"attachments\\":[]},{\\"id\\":\\"testhistory01res\\",\\"role\\":\\"robot\\",\\"content\\":\\"你好!我是一个AI助手,可以帮助您完成各种任务。我可以:\\\\n\\\\n- 浏览网页和搜索信息\\\\n- 读取和处理文件\\\\n- 管理文件和目录\\\\n- 清理系统垃圾文件\\\\n- 操作数据库\\\\n- 执行自定义功能\\\\n\\\\n请问有什么我可以帮助您的吗?\\",\\"contentType\\":\\"text\\",\\"timestamp\\":1757385539220,\\"status\\":\\"ok\\",\\"messageSegmentIndex\\":0,\\"visible\\":true,\\"sessionId\\":\\"P_CB_e65f89d5f2e04f1cac4f87b5eeea55a2\\",\\"loading\\":false,\\"showImmediately\\":false,\\"references\\":[],\\"tip\\":\\"\\",\\"streamId\\":\\"\\"}]"} 200 ${token}
Should Be Equal As Strings ${content["code"]} 200
Set Global Variable ${share_id} ${content["data"]}
反例-不传入token
[Tags] E
create session URI ${URL}
${content} POST请求结果 ${path} {"session_id":"P_CB_e65f89d5f2e04f1cac4f87b5eeea55a2","name":"简洁问候语1757385499220","type":"normal","snapshot_data":"[{\\"id\\":\\"testhistory\\",\\"role\\":\\"user\\",\\"content\\":\\"你好\\",\\"contentType\\":\\"text\\",\\"timestamp\\":1757385499220,\\"status\\":\\"ok\\",\\"messageSegmentIndex\\":0,\\"visible\\":true,\\"attachments\\":[]},{\\"id\\":\\"testhistoryres\\",\\"role\\":\\"robot\\",\\"content\\":\\"你好!今天有什么我可以帮助你的吗?\\",\\"contentType\\":\\"text\\",\\"timestamp\\":1757385519220,\\"status\\":\\"ok\\",\\"messageSegmentIndex\\":0,\\"visible\\":true,\\"sessionId\\":\\"P_CB_e65f89d5f2e04f1cac4f87b5eeea55a2\\",\\"loading\\":false,\\"showImmediately\\":false,\\"references\\":[],\\"tip\\":\\"\\",\\"streamId\\":\\"\\"},{\\"id\\":\\"testhistory01\\",\\"role\\":\\"user\\",\\"content\\":\\"你好\\",\\"contentType\\":\\"text\\",\\"timestamp\\":1757385529220,\\"status\\":\\"ok\\",\\"messageSegmentIndex\\":0,\\"visible\\":true,\\"attachments\\":[]},{\\"id\\":\\"testhistory01res\\",\\"role\\":\\"robot\\",\\"content\\":\\"你好!我是一个AI助手,可以帮助您完成各种任务。我可以:\\\\n\\\\n- 浏览网页和搜索信息\\\\n- 读取和处理文件\\\\n- 管理文件和目录\\\\n- 清理系统垃圾文件\\\\n- 操作数据库\\\\n- 执行自定义功能\\\\n\\\\n请问有什么我可以帮助您的吗?\\",\\"contentType\\":\\"text\\",\\"timestamp\\":1757385539220,\\"status\\":\\"ok\\",\\"messageSegmentIndex\\":0,\\"visible\\":true,\\"sessionId\\":\\"P_CB_e65f89d5f2e04f1cac4f87b5eeea55a2\\",\\"loading\\":false,\\"showImmediately\\":false,\\"references\\":[],\\"tip\\":\\"\\",\\"streamId\\":\\"\\"}]"} 401 ${EMPTY}
Should Be Equal As Strings ${content["detail"]} 没有找到认证信息
反例-传入空白token
[Tags] E
create session URI ${URL}
${content} POST请求结果 ${path} {"session_id":"P_CB_e65f89d5f2e04f1cac4f87b5eeea55a2","name":"简洁问候语1757385499220","type":"normal","snapshot_data":"[{\\"id\\":\\"testhistory\\",\\"role\\":\\"user\\",\\"content\\":\\"你好\\",\\"contentType\\":\\"text\\",\\"timestamp\\":1757385499220,\\"status\\":\\"ok\\",\\"messageSegmentIndex\\":0,\\"visible\\":true,\\"attachments\\":[]},{\\"id\\":\\"testhistoryres\\",\\"role\\":\\"robot\\",\\"content\\":\\"你好!今天有什么我可以帮助你的吗?\\",\\"contentType\\":\\"text\\",\\"timestamp\\":1757385519220,\\"status\\":\\"ok\\",\\"messageSegmentIndex\\":0,\\"visible\\":true,\\"sessionId\\":\\"P_CB_e65f89d5f2e04f1cac4f87b5eeea55a2\\",\\"loading\\":false,\\"showImmediately\\":false,\\"references\\":[],\\"tip\\":\\"\\",\\"streamId\\":\\"\\"},{\\"id\\":\\"testhistory01\\",\\"role\\":\\"user\\",\\"content\\":\\"你好\\",\\"contentType\\":\\"text\\",\\"timestamp\\":1757385529220,\\"status\\":\\"ok\\",\\"messageSegmentIndex\\":0,\\"visible\\":true,\\"attachments\\":[]},{\\"id\\":\\"testhistory01res\\",\\"role\\":\\"robot\\",\\"content\\":\\"你好!我是一个AI助手,可以帮助您完成各种任务。我可以:\\\\n\\\\n- 浏览网页和搜索信息\\\\n- 读取和处理文件\\\\n- 管理文件和目录\\\\n- 清理系统垃圾文件\\\\n- 操作数据库\\\\n- 执行自定义功能\\\\n\\\\n请问有什么我可以帮助您的吗?\\",\\"contentType\\":\\"text\\",\\"timestamp\\":1757385539220,\\"status\\":\\"ok\\",\\"messageSegmentIndex\\":0,\\"visible\\":true,\\"sessionId\\":\\"P_CB_e65f89d5f2e04f1cac4f87b5eeea55a2\\",\\"loading\\":false,\\"showImmediately\\":false,\\"references\\":[],\\"tip\\":\\"\\",\\"streamId\\":\\"\\"}]"} 401 {}
Should Be Equal As Strings ${content["detail"]} 无效的access token
反例-不传入session_id参数
[Tags] E
create session URI ${URL}
${content} POST请求结果 ${path} {"name":"简洁问候语1757385499220","type":"normal","snapshot_data":"[{\\"id\\":\\"testhistory\\",\\"role\\":\\"user\\",\\"content\\":\\"你好\\",\\"contentType\\":\\"text\\",\\"timestamp\\":1757385499220,\\"status\\":\\"ok\\",\\"messageSegmentIndex\\":0,\\"visible\\":true,\\"attachments\\":[]},{\\"id\\":\\"testhistoryres\\",\\"role\\":\\"robot\\",\\"content\\":\\"你好!今天有什么我可以帮助你的吗?\\",\\"contentType\\":\\"text\\",\\"timestamp\\":1757385519220,\\"status\\":\\"ok\\",\\"messageSegmentIndex\\":0,\\"visible\\":true,\\"sessionId\\":\\"P_CB_e65f89d5f2e04f1cac4f87b5eeea55a2\\",\\"loading\\":false,\\"showImmediately\\":false,\\"references\\":[],\\"tip\\":\\"\\",\\"streamId\\":\\"\\"},{\\"id\\":\\"testhistory01\\",\\"role\\":\\"user\\",\\"content\\":\\"你好\\",\\"contentType\\":\\"text\\",\\"timestamp\\":1757385529220,\\"status\\":\\"ok\\",\\"messageSegmentIndex\\":0,\\"visible\\":true,\\"attachments\\":[]},{\\"id\\":\\"testhistory01res\\",\\"role\\":\\"robot\\",\\"content\\":\\"你好!我是一个AI助手,可以帮助您完成各种任务。我可以:\\\\n\\\\n- 浏览网页和搜索信息\\\\n- 读取和处理文件\\\\n- 管理文件和目录\\\\n- 清理系统垃圾文件\\\\n- 操作数据库\\\\n- 执行自定义功能\\\\n\\\\n请问有什么我可以帮助您的吗?\\",\\"contentType\\":\\"text\\",\\"timestamp\\":1757385539220,\\"status\\":\\"ok\\",\\"messageSegmentIndex\\":0,\\"visible\\":true,\\"sessionId\\":\\"P_CB_e65f89d5f2e04f1cac4f87b5eeea55a2\\",\\"loading\\":false,\\"showImmediately\\":false,\\"references\\":[],\\"tip\\":\\"\\",\\"streamId\\":\\"\\"}]"} 422 ${token}
Should Be Equal As Strings ${content["detail"][0]["type"]} missing
反例-不传入snapshot_data参数
[Tags] E
create session URI ${URL}
${content} POST请求结果 ${path} {"session_id":"P_CB_e65f89d5f2e04f1cac4f87b5eeea55a2","name":"简洁问候语1757385499220","type":"normal"} 422 ${token}
Should Be Equal As Strings ${content["detail"][0]["type"]} missing
反例-传入空的snapshot_data
[Tags] E
create session URI ${URL}
${content} POST请求结果 ${path} {"session_id":"P_CB_e65f89d5f2e04f1cac4f87b5eeea55a2","name":"简洁问候语1757385499220","type":"normal","snapshot_data":"[]"} 200 ${token}
Should Be Equal As Strings ${content["code"]} 200
*** Settings ***
Library RequestsLibrary
Resource flow_zmx.resource
Resource res_zmx.resource
*** Variables ***
${path} /api/v1/share/get_share
*** Test Cases ***
正例-获取分享会话成功
[Tags] F
create session URI ${URL}
${full_path} Catenate ${path}/${share_id}
${content} GET请求结果 ${full_path} {} 200 ${EMPTY}
Should Be Equal As Strings ${content["code"]} 200
Should Contain ${content} data
反例-使用不存在的分享ID
[Tags] E
create session URI ${URL}
${full_path} Catenate ${path}/nonexistent1234567890
${content} GET请求结果 ${full_path} {} 404 ${EMPTY}
Should Contain ${content} detail
反例-使用空的分享ID
[Tags] E
create session URI ${URL}
${full_path} Catenate ${path}/
${content} GET请求结果 ${full_path} {} 405 ${EMPTY}
Should Contain ${content} detail
反例-使用无效格式的分享ID
[Tags] E
create session URI ${URL}
${full_path} Catenate ${path}/invalid-share-id-format
${content} GET请求结果 ${full_path} {} 404 ${EMPTY}
Should Contain ${content} detail
\ No newline at end of file
*** Settings ***
Library RequestsLibrary
Resource flow_zmx.resource
Resource res_zmx.resource
*** Variables ***
${path} /api/v1/mcp/create_or_update
*** Test Cases ***
正例-创建MCP服务成功
[Tags] F
${secs1} Get Time epoch
create session URI ${URL}
${content} POST请求结果 ${path} {"name":"接口测试${secs1}","description":"来自接口的数据","url":"https://www.mcpcn.cc/mcp/LotteryQuery/9853b040-081d-47cb-8d3f-d6a42905f696","scope":["general","explore"],"auth":{"type":"none","username":"","password":"","token":""},"headers":{},"type":"streamable","created_by_name":""} 200 ${zh_token}
Should Be Equal As Strings ${content["code"]} 200
Should Contain ${content} data
Set Global Variable ${MCP_id} ${content["data"]}
正例-更新MCP服务成功
[Tags] F
${secs1} Get Time epoch
create session URI ${URL}
${content} POST请求结果 ${path} {"id":${MCP_id},"name":"接口测试${secs1}","description":"来自接口的数据,更新测试","url":"https://www.mcpcn.cc/mcp/LotteryQuery/9853b040-081d-47cb-8d3f-d6a42905f696","scope":["general","explore"],"auth":{"type":"none","username":"","password":"","token":""},"headers":{},"type":"streamable","created_by_name":"接口测试租管"} 200 ${zh_token}
Should Be Equal As Strings ${content["code"]} 200
Should Contain ${content} data
Set Global Variable ${MCP_i} ${content["data"]}
反例-不传入token
[Tags] E
${secs1} Get Time epoch
create session URI ${URL}
${content} POST请求结果 ${path} {"name":"接口测试${secs1}","description":"来自接口的数据","url":"https://www.mcpcn.cc/mcp/LotteryQuery/9853b040-081d-47cb-8d3f-d6a42905f696","scope":["general","explore"],"auth":{"type":"none","username":"","password":"","token":""},"headers":{},"type":"streamable","created_by_name":""} 401 ${EMPTY}
Should Be Equal As Strings ${content["detail"]} 没有找到认证信息
反例-传入空白token
[Tags] E
${secs1} Get Time epoch
create session URI ${URL}
${content} POST请求结果 ${path} {"name":"接口测试${secs1}","description":"来自接口的数据","url":"https://www.mcpcn.cc/mcp/LotteryQuery/9853b040-081d-47cb-8d3f-d6a42905f696","scope":["general","explore"],"auth":{"type":"none","username":"","password":"","token":""},"headers":{},"type":"streamable","created_by_name":""} 401 {}
Should Be Equal As Strings ${content["detail"]} 无效的access token
反例-不传入name参数
[Tags] E
${secs1} Get Time epoch
create session URI ${URL}
${content} POST请求结果 ${path} {"description":"来自接口的数据","url":"https://www.mcpcn.cc/mcp/LotteryQuery/9853b040-081d-47cb-8d3f-d6a42905f696","scope":["general","explore"],"auth":{"type":"none","username":"","password":"","token":""},"headers":{},"type":"streamable","created_by_name":""} 422 ${zh_token}
Should Contain ${content} detail
反例-不传入url参数
[Tags] E
${secs1} Get Time epoch
create session URI ${URL}
${content} POST请求结果 ${path} {"name":"接口测试${secs1}","description":"来自接口的数据","scope":["general","explore"],"auth":{"type":"none","username":"","password":"","token":""},"headers":{},"type":"streamable","created_by_name":""} 422 ${zh_token}
Should Contain ${content} detail
*** Settings ***
Library RequestsLibrary
Resource flow_zmx.resource
Resource res_zmx.resource
*** Variables ***
${path} /api/v1/mcp/page
*** Test Cases ***
正例-获取MCP服务列表成功
[Tags] F
create session URI ${URL}
${content} POST请求结果 ${path} {"page_index":0,"page_size":20} 200 ${zh_token}
Should Be Equal As Strings ${content["code"]} 200
Should Contain ${content} data
反例-不传入token
[Tags] E
create session URI ${URL}
${content} POST请求结果 ${path} {"page_index":0,"page_size":20} 401 ${EMPTY}
Should Be Equal As Strings ${content["detail"]} 没有找到认证信息
反例-传入空白token
[Tags] E
create session URI ${URL}
${content} POST请求结果 ${path} {"page_index":0,"page_size":20} 401 {}
Should Be Equal As Strings ${content["detail"]} 无效的access token
反例-不传入page_index参数
[Tags] E
create session URI ${URL}
${content} POST请求结果 ${path} {"page_size":20} 200 ${zh_token}
Should Be Equal As Strings ${content["code"]} 200
Should Contain ${content} data
反例-不传入page_size参数
[Tags] E
create session URI ${URL}
${content} POST请求结果 ${path} {"page_index":0} 200 ${token}
Should Be Equal As Strings ${content["code"]} 200
Should Contain ${content} data
反例-传入非法的page_index格式
[Tags] E
create session URI ${URL}
${content} POST请求结果 ${path} {"page_index":"abc","page_size":20} 422 ${zh_token}
Should Contain ${content} detail
\ No newline at end of file
*** Settings ***
Library RequestsLibrary
Resource flow_zmx.resource
Resource res_zmx.resource
*** Variables ***
${path} /api/v1/mcp/detail
*** Test Cases ***
正例-获取MCP服务详情成功
[Tags] F
create session URI ${URL}
${content} GET请求结果 ${path}/${mcp_id} {} 200 ${zh_token}
Should Be Equal As Strings ${content["code"]} 200
Should Contain ${content} data
Should Be Equal As Strings ${content["data"]["id"]} ${mcp_id}
Should Contain ${content["data"]} name
Should Contain ${content["data"]} description
Should Contain ${content["data"]} type
Should Contain ${content["data"]} url
Should Contain ${content["data"]} state
Should Contain ${content["data"]} auth
反例-不传入token
[Tags] E
create session URI ${URL}
${content} GET请求结果 ${path}/${mcp_id} {} 401 ${EMPTY}
Should Be Equal As Strings ${content["detail"]} 没有找到认证信息
反例-传入空白token
[Tags] E
create session URI ${URL}
${content} GET请求结果 ${path}/${mcp_id} {} 401 ${EMPTY}
Should Be Equal As Strings ${content["detail"]} 没有找到认证信息
反例-传入不存在的MCP ID
[Tags] E
create session URI ${URL}
${content} GET请求结果 ${path}/999999 {} 200 ${zh_token}
Should Contain ${content["code"]} 200
反例-传入非法格式的MCP ID
[Tags] E
create session URI ${URL}
${content} GET请求结果 ${path}/abc {} 422 ${zh_token}
Should Contain ${content} detail
\ No newline at end of file
*** Settings ***
Library RequestsLibrary
Resource flow_zmx.resource
Resource res_zmx.resource
*** Variables ***
${path} /api/v1/mcp/test/srv-conn
*** Test Cases ***
测试已保存的MCP服务成功
create session URI ${URL}
${content} GET请求结果 ${path}/${mcp_id} {} 200 ${zh_token}
Should Be Equal As Strings ${content["code"]} 200
Should Contain ${content["data"]} state
Should Be Equal As Strings ${content["data"]["state"]} active
Should Contain ${content["data"]} tools
Should Contain ${content["data"]} tools_count
Should Be Equal As Strings ${content["data"]["tools_count"]} 4
不传入token
create session URI ${URL}
${content} GET请求结果 ${path}/${mcp_id} {} 401 ${EMPTY}
Should Be Equal As Strings ${content["detail"]} 没有找到认证信息
传入空白token
create session URI ${URL}
${content} GET请求结果 ${path}/${mcp_id} {} 401 ${EMPTY}
Should Be Equal As Strings ${content["detail"]} 没有找到认证信息
传入不存在的MCP服务ID
create session URI ${URL}
${content} GET请求结果 ${path}/999999 {} 200 ${zh_token}
Should Contain ${content["code"]} 200
传入非法格式的MCP服务ID
create session URI ${URL}
${content} GET请求结果 ${path}/abc {} 422 ${zh_token}
Should Contain ${content} detail
\ No newline at end of file
*** Settings ***
Library RequestsLibrary
Resource flow_zmx.resource
Resource res_zmx.resource
*** Variables ***
${path} /api/v1/mcp/test/conn
*** Test Cases ***
测试未保存的MCP服务成功
create session URI ${URL}
${data} set variable {"url":"https://www.mcpcn.cc/mcp/LotteryQuery/9853b040-081d-47cb-8d3f-d6a42905f696","type":"streamable","auth":{"type":"none","username":"","password":"","token":""},"headers":{}}
${content} POST请求结果 ${path} ${data} 200 ${zh_token}
Should Be Equal As Strings ${content["code"]} 200
Should Be True ${content["data"]}
不传入token
create session URI ${URL}
${data} set variable {"url":"https://www.mcpcn.cc/mcp/LotteryQuery/9853b040-081d-47cb-8d3f-d6a42905f696","type":"streamable","auth":{"type":"none","username":"","password":"","token":""},"headers":{}}
${content} POST请求结果 ${path} ${data} 401 ${EMPTY}
Should Be Equal As Strings ${content["detail"]} 没有找到认证信息
传入空白token
create session URI ${URL}
${data} set variable {"url":"https://www.mcpcn.cc/mcp/LotteryQuery/9853b040-081d-47cb-8d3f-d6a42905f696","type":"streamable","auth":{"type":"none","username":"","password":"","token":""},"headers":{}}
${content} POST请求结果 ${path} ${data} 401 ${EMPTY}
Should Be Equal As Strings ${content["detail"]} 没有找到认证信息
不传入url参数
create session URI ${URL}
${data} set variable {"type":"streamable","auth":{"type":"none","username":"","password":"","token":""},"headers":{}}
${content} POST请求结果 ${path} ${data} 422 ${zh_token}
Should Contain ${content} detail
传入无效的URL格式
create session URI ${URL}
${data} set variable {"url":"invalid-url","type":"streamable","auth":{"type":"none","username":"","password":"","token":""},"headers":{}}
${content} POST请求结果 ${path} ${data} 200 ${zh_token}
Should Not Be True ${content["data"]}
不传入type参数
create session URI ${URL}
${data} set variable {"url":"https://www.mcpcn.cc/mcp/LotteryQuery/9853b040-081d-47cb-8d3f-d6a42905f696","auth":{"type":"none","username":"","password":"","token":""},"headers":{}}
${content} POST请求结果 ${path} ${data} 422 ${zh_token}
Should Contain ${content} detail
\ No newline at end of file
*** Settings ***
Library RequestsLibrary
Resource flow_zmx.resource
Resource res_zmx.resource
*** Variables ***
${path} /api/v1/mcp/switch
*** Test Cases ***
禁用MCP服务成功
create session URI ${URL}
${data} set variable {"id":${mcp_id},"active":false}
${content} POST请求结果 ${path} ${data} 200 ${zh_token}
Should Be Equal As Strings ${content["code"]} 200
Should Not Be True ${content["data"]}
启用MCP服务成功
create session URI ${URL}
${data} set variable {"id":${mcp_id},"active":true}
${content} POST请求结果 ${path} ${data} 200 ${zh_token}
Should Be Equal As Strings ${content["code"]} 200
Should Be True ${content["data"]}
不传入token
create session URI ${URL}
${data} set variable {"id":${mcp_id},"active":false}
${content} POST请求结果 ${path} ${data} 401 ${EMPTY}
Should Be Equal As Strings ${content["detail"]} 没有找到认证信息
传入空白token
create session URI ${URL}
${data} set variable {"id":${mcp_id},"active":false}
${content} POST请求结果 ${path} ${data} 401 ${EMPTY}
Should Be Equal As Strings ${content["detail"]} 没有找到认证信息
不传入id参数
create session URI ${URL}
${data} set variable {"active":false}
${content} POST请求结果 ${path} ${data} 422 ${zh_token}
Should Contain ${content} detail
不传入active参数
create session URI ${URL}
${data} set variable {"id":${mcp_id}}
${content} POST请求结果 ${path} ${data} 200 ${zh_token}
Should Be True ${content["data"]}
传入不存在的MCP服务ID
create session URI ${URL}
${data} set variable {"id":999999,"active":false}
${content} POST请求结果 ${path} ${data} 200 ${zh_token}
Should Be Equal As Strings ${content["code"]} 200
\ No newline at end of file
*** Settings ***
Library RequestsLibrary
Resource flow_zmx.resource
Resource res_zmx.resource
*** Variables ***
${path} /api/v1/mcp/delete
*** Test Cases ***
删除MCP服务成功
create session URI ${URL}
${full_path} set variable ${path}/${mcp_id}
${content} POST请求结果 ${full_path} {} 200 ${zh_token}
Should Be Equal As Strings ${content["code"]} 200
Should Be Equal ${content["data"]} ${None}
不传入token
create session URI ${URL}
${full_path} set variable ${path}/${mcp_id}
${content} POST请求结果 ${full_path} {} 401 ${EMPTY}
Should Be Equal As Strings ${content["detail"]} 没有找到认证信息
传入空白token
create session URI ${URL}
${full_path} set variable ${path}/${mcp_id}
${content} POST请求结果 ${full_path} {} 401 ${EMPTY}
Should Be Equal As Strings ${content["detail"]} 没有找到认证信息
传入不存在的MCP服务ID
create session URI ${URL}
${full_path} set variable ${path}/9999
${content} POST请求结果 ${full_path} {} 200 ${zh_token}
Should Be Equal As Strings ${content["code"]} 200
传入非法格式的MCP服务ID
create session URI ${URL}
${full_path} set variable ${path}/abc
${content} POST请求结果 ${full_path} {} 422 ${zh_token}
Should Contain ${content} detail
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论