I'm currently learning Tavern for Rest testing and I have a problem creating a test.
This is an example of the curl I need to create in Tavern:
curl -f -v -i -X POST -H "Authorization:Bearer XXX...XXXX" -F package=@/dir1/dir2/MY_FILE http://url
With curl is working propertly and send the file but with Tavern we are receiving:
Traceback (most recent call last): File "/home/luis/.local/bin/tavern-ci", line 11, in sys.exit(main()) File "/home/luis/.local/lib/python2.7/site-packages/tavern/entry.py", line 112, in main exit(not run(**vargs)) File "/home/luis/.local/lib/python2.7/site-packages/tavern/core.py", line 167, in run run_test(in_file, test_spec, global_cfg) File "/home/luis/.local/lib/python2.7/site-packages/tavern/core.py", line 102, in run_test response = r.run() File "/home/luis/.local/lib/python2.7/site-packages/tavern/request/rest.py", line 201, in run return self._prepared() File "/home/luis/.local/lib/python2.7/site-packages/tavern/request/rest.py", line 185, in prepared_request open(filepath, "rb")) IOError: [Errno 2] No such file or directory: '@/dir1/dir2/MY_FILE'
And this is the content of the Tavern test :
name: upload_file
request:
enter code here
url: http://url
method: POST
files:
package: "@/dir1/dir2/MY_FILE"
headers:
authorization: "Bearer {test_login_token:s}"
response:
status_code: 201
I think the problem is in the @ we put in the curl but in not sure how to solve it.
thanks in advance
Aucun commentaire:
Enregistrer un commentaire