Skip to content
This repository has been archived by the owner on Aug 20, 2024. It is now read-only.

Facing issue while verifying upload API in robot framework using python #275

Open
SuperSonic-creator opened this issue May 20, 2020 · 0 comments

Comments

@SuperSonic-creator
Copy link

I am very new to testing / developing. I am currently testing a REST API. In Postman I send a POST request by specifying parameters and uploading a file using form-data in the body. My request always succeeds. However, when I try to translate this into Robot Framework (using the Requests Library), I
I am posting my code below. I have been trying to resolve this issue for a while now. Any help in the right direction would be much appreciated!

Create Session alias ${uri}
${file_name}= Get Binary File Test.png
${headers}= Create Dictionary Accept=plain/text Content-Type=multipart/form-data
${data}= create dictionary asset=${file_name}
${resp}= post request alias /api/insertFile data=${file_name} headers=${headers}
Should Be Equal As Strings ${resp.status_code} 200
log to console ${resp.content}
log to console ${resp.headers}

It is giving me 200 always in server log also expected response is true but getting false every time. Although the same API is working perfectly in the Postman tool.

Attached server log

ServerLog

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant