*** Settings ***
Resource          flow_zmx.resource
Resource          res_zmx.resource

*** Variables ***
${path}           /api/ability

*** Test Cases ***
正例-删除能力
    [Tags]    F
    create session    URI    ${URL}
    &{header}    Create Dictionary    Authorization=${token}    Content-Type=application/json
    ${PARAMS}    Create Dictionary    id=${bid}
    ${resp}    Delete On Session    URI    ${path}    params=${PARAMS}    headers=${header}    expected_status=200
    Should Be Equal As Integers    ${resp.status_code}    200
    ${content}    Set Variable    ${resp.json()}
    log    ${content}
    Should Be Equal As Strings    ${content["code"]}    200

反例-不传入token
    [Tags]    E
    create session    URI    ${URL}
    ${content}    DEL请求结果    ${path}    {"id":"${bid}"}    401    {}
    log    ${content}
    Should Be Equal As Strings    ${content["code"]}    401
    Should Be Equal As Strings    ${content["code"]}    401

反例-传入错误参数
    [Tags]    E
    create session    URI    ${URL}
    ${content}    DEL请求结果    ${path}    {"workerId":"a68ad587830d41aebf418a919006353e"}    422    ${token}
    log    ${content}
    Should Be Equal As Strings    ${content["detail"][0]["msg"]}    Field required

反例-传入空参数
    [Tags]    E
    create session    URI    ${URL}
    ${content}    DEL请求结果    ${path}    {}    422    ${token}
    log    ${content}
    Should Be Equal As Strings    ${content["detail"][0]["msg"]}    Field required

反例-删除已删除能力
    [Tags]    F
    create session    URI    ${URL}
    &{header}    Create Dictionary    Authorization=${token}    Content-Type=application/json
    ${PARAMS}    Create Dictionary    id=${bid}
    ${resp}    Delete On Session    URI    ${path}    params=${PARAMS}    headers=${header}    expected_status=200
    Should Be Equal As Integers    ${resp.status_code}    200
    ${content}    Set Variable    ${resp.json()}
    log    ${content}
    Should Be Equal As Strings    ${content["code"]}    200
