How to validate status code in robot framework

Viewed 442

i about to make a validation status code in robot framework. i create value in json with wrong password and i want to make validation code 400 bad request with this code.

login_negative_user

${json}     Load JSON From File     ${CURDIR}/../json/negativeuser.json
# Set Test Variable   ${JSON_SCHEMA}  ${json}
${resp}=    POST    ${base_url}/horde/v1/auth/login     json=${json}
${data}     Convert To String       ${resp.json()}
Status Should Be    400 ${resp}
Should Be Equal As Strings      ${resp.status_code}     400
${jsondata}     evaluate    ${data}
${poselang}=    Set Variable    ${jsondata['data']['token']}

Set Global Variable     ${poselang}
log to console  Get poselang token

But my log is this

login negativeuser                                                    | FAIL |

HTTPError: 400 Client Error: Bad Request for url: {secret api}

am i wrong to make validation with that code? sorry i cant tell the api because it is secret

0 Answers
Related