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

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

*** Test Cases ***
正例-正常新增网页说明
    [Tags]    F
    ${secs1}    Get Time    epoch
    create session    URI    ${URL}
    ${content}    POST请求结果    ${path}    {"url":"http://www.zhipin.com/${secs1}","instruction":"这是来自接口的数据","active":true,"level":2}    200    ${zh_token}
    log    ${content}
    Should Be Equal As Strings    ${content["code"]}    200
    Should Be Equal As Strings    ${content["message"]}    WebInstruction created successfully
    Set Global Variable    ${WI_id}    ${content["data"]["id"]}

反例-使用普通权限新增网页说明
    [Tags]    E
    ${secs1}    Get Time    epoch
    create session    URI    ${URL}
    ${content}    POST请求结果    ${path}    {"url":"http://www.zhipin.com/${secs1}","instruction":"这是来自接口的数据，普通权限","active":true,"level":2}    200    ${token}
    log    ${content}
    Should Be Equal As Strings    ${content["code"]}    200
    Should Be Equal As Strings    ${content["message"]}    WebInstruction created successfully
    Set Global Variable    ${WI_id_normal}    ${content["data"]["id"]}

反例-不传入token
    [Tags]    E
    ${secs1}    Get Time    epoch
    create session    URI    ${URL}
    ${content}    POST请求结果    ${path}    {"url":"http://www.zhipin.com/${secs1}","instruction":"这是来自接口的数据","active":true,"level":2}    401    ${EMPTY}
    log    ${content}
    Should Be Equal As Strings    ${content["code"]}    401

反例-传入空白token
    [Tags]    E
    ${secs1}    Get Time    epoch
    create session    URI    ${URL}
    ${content}    POST请求结果    ${path}    {"url":"http://www.zhipin.com/${secs1}","instruction":"这是来自接口的数据","active":true,"level":2}    401    {}
    log    ${content}
    Should Be Equal As Strings    ${content["code"]}    401

反例-不传入url参数
    [Tags]    E
    create session    URI    ${URL}
    ${content}    POST请求结果    ${path}    {"instruction":"这是来自接口的数据","active":true,"level":2}    422    ${zh_token}
    log    ${content}
    Should Be Equal As Strings    ${content["detail"][0]["type"]}    missing

反例-不传入instruction参数
    [Tags]    E
    ${secs1}    Get Time    epoch
    create session    URI    ${URL}
    ${content}    POST请求结果    ${path}    {"url":"http://www.zhipin.com/${secs1}","active":true,"level":2}    422    ${zh_token}
    log    ${content}
    Should Be Equal As Strings    ${content["detail"][0]["type"]}    missing
