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

*** Variables ***
${path}           /api/v1/task/create

*** Test Cases ***
正例-正常创建任务
    [Tags]    F
    create session    URI    ${URL}
    ${content}    POST请求结果    ${path}    {"ability_id":${bid},"executor_type":"client","dispatch_type":"immediate","parameters":{},"extensions":{"skipError":false,"useIncognito":false,"closePage":true,"stepInterval":1000,"autoFocus":false},"outputs_schema":[]}    200    ${token}
    log    ${content}
    Should Be Equal As Strings    ${content["code"]}    200
    Set Global Variable    ${task_id}    ${content["data"]}

反例-不传入token
    [Tags]    E
    create session    URI    ${URL}
    ${content}    POST请求结果    ${path}    {"ability_id":${bid},"executor_type":"client","dispatch_type":"immediate","parameters":{},"extensions":{"skipError":false,"useIncognito":false,"closePage":true,"stepInterval":1000,"autoFocus":false},"outputs_schema":[]}    401    ${EMPTY}
    log    ${content}
    Should Be Equal As Strings    ${content["code"]}    401

反例-传入空白token
    [Tags]    E
    create session    URI    ${URL}
    ${content}    POST请求结果    ${path}    {"ability_id":${bid},"executor_type":"client","dispatch_type":"immediate","parameters":{},"extensions":{"skipError":false,"useIncognito":false,"closePage":true,"stepInterval":1000,"autoFocus":false},"outputs_schema":[]}    401    {}
    log    ${content}
    Should Be Equal As Strings    ${content["code"]}    401

反例-不传入ability_id参数
    [Tags]    E
    create session    URI    ${URL}
    ${content}    POST请求结果    ${path}    {"executor_type":"client","dispatch_type":"immediate","parameters":{},"extensions":{"skipError":false,"useIncognito":false,"closePage":true,"stepInterval":1000,"autoFocus":false},"outputs_schema":[]}    422    ${token}
    log    ${content}
    Should Be Equal As Strings    ${content["detail"][0]["type"]}    missing

反例-不传入executor_type参数
    [Tags]    E
    create session    URI    ${URL}
    ${content}    POST请求结果    ${path}    {"ability_id":${bid},"dispatch_type":"immediate","parameters":{},"extensions":{"skipError":false,"useIncognito":false,"closePage":true,"stepInterval":1000,"autoFocus":false},"outputs_schema":[]}    422    ${token}
    log    ${content}
    Should Be Equal As Strings    ${content["detail"][0]["type"]}    missing

反例-不传入dispatch_type参数
    [Tags]    E
    create session    URI    ${URL}
    ${content}    POST请求结果    ${path}    {"ability_id":${bid},"executor_type":"client","parameters":{},"extensions":{"skipError":false,"useIncognito":false,"closePage":true,"stepInterval":1000,"autoFocus":false},"outputs_schema":[]}    422    ${token}
    log    ${content}
    Should Be Equal As Strings    ${content["detail"][0]["type"]}    missing
