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

*** Variables ***
${path}           /api/v1/plan/generate_cron

*** Test Cases ***
正例-正常生成cron表达式(每天上午9点)
    [Tags]    F
    create session    URI    ${URL}
    ${content}    POST请求结果    ${path}    {"user_input":"每天上午9点执行一次"}    200    ${token}
    log    ${content}
    Should Be Equal As Strings    ${content["code"]}    200

正例-正常生成cron表达式(每周一执行)
    [Tags]    F
    create session    URI    ${URL}
    ${content}    POST请求结果    ${path}    {"user_input":"每周一执行一次"}    200    ${token}
    log    ${content}
    Should Be Equal As Strings    ${content["code"]}    200

反例-不传入token
    [Tags]    E
    create session    URI    ${URL}
    ${content}    POST请求结果    ${path}    {"user_input":"每天上午9点执行一次"}    401    ${EMPTY}
    log    ${content}
    Should Be Equal As Strings    ${content["code"]}    401

反例-传入空白token
    [Tags]    E
    create session    URI    ${URL}
    ${content}    POST请求结果    ${path}    {"user_input":"每天上午9点执行一次"}    401    {}
    log    ${content}
    Should Be Equal As Strings    ${content["code"]}    401

反例-不传入user_input参数
    [Tags]    E
    create session    URI    ${URL}
    ${content}    POST请求结果    ${path}    {}    422    ${token}
    log    ${content}
    Should Be Equal As Strings    ${content["detail"][0]["type"]}    missing
