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

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

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