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

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

*** Test Cases ***
正例-正常更新网页说明
    [Tags]    F
    ${secs1}    Get Time    epoch
    create session    URI    ${URL}
    ${content}    POST请求结果    ${path}/${WI_id}    {"url":"http://www.zhipin.com/${secs1}","instruction":"这是来自接口的数据${secs1}","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 updated successfully

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

反例-不传入token
    [Tags]    E
    ${secs1}    Get Time    epoch
    create session    URI    ${URL}
    ${content}    POST请求结果    ${path}/${WI_id}    {"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}/${WI_id}    {"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}/${WI_id}    {"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 updated successfully

反例-不传入instruction参数
    [Tags]    E
    ${secs1}    Get Time    epoch
    create session    URI    ${URL}
    ${content}    POST请求结果    ${path}/${WI_id}    {"url":"http://www.zhipin.com/${secs1}","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 updated successfully
