*** 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["code"]}    401

传入空白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["code"]}    401

不传入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
