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

*** Variables ***
${path}           /api/system/issue

*** Test Cases ***
正例-正常上报反馈
    [Tags]    F
    create session    URI    ${URL}
    ${file}    Evaluate    (r'testissue.zip', open(r'${CURDIR}${/}testfiles${/}testissue.zip', 'rb'))
    ${header}    Create Dictionary    Authorization=${token}
    ${files}    Create Dictionary    file=${file}
    ${resp}    Post On Session    URI    ${path}    files=${files}    headers=${header}
    ${content}    Set Variable    ${resp.json()}
    log    ${content}
    Should Be Equal As Strings    ${content["code"]}    200
    Should Be Equal As Strings    ${content["message"]}    成功

反例-不传token
    [Tags]    E
    create session    URI    ${URL}
    ${file}    Evaluate    (r'testissue.zip', open(r'${CURDIR}${/}testfiles${/}testissue.zip', 'rb'))
    ${header}    Create Dictionary    Authorization=${EMPTY}
    ${files}    Create Dictionary    file=${file}
    ${resp}    Post On Session    URI    ${path}    files=${files}    headers=${header}
    ${content}    Set Variable    ${resp.json()}
    log    ${content}
    Should Be Equal As Strings    ${content["code"]}    200
    Should Be Equal As Strings    ${content["message"]}    成功

反例-传入错误的token
    [Tags]    E
    create session    URI    ${URL}
    ${file}    Evaluate    (r'testissue.zip', open(r'${CURDIR}${/}testfiles${/}testissue.zip', 'rb'))
    ${header}    Create Dictionary    Authorization=testtoken
    ${files}    Create Dictionary    file=${file}
    ${resp}    Post On Session    URI    ${path}    files=${files}    headers=${header}
    ${content}    Set Variable    ${resp.json()}
    log    ${content}
    Should Be Equal As Strings    ${content["code"]}    200
    Should Be Equal As Strings    ${content["message"]}    成功
