I need to test API for multipart/form-data using pyresttest. I have tried https://github.com/svanoort/pyresttest/issues/158 for my API but it's not working.
I have created formdata.txt
:
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data"; filename="/D:/File-Upload/movie.json"
Content-Type: application/json
(data)
----WebKitFormBoundary7MA4YWxkTrZu0gW
and my yaml file look like:
- test:
- group: "Group test"
- name: "Test name"
- url: "/post_movie/"
- method: "POST"
- headers: {'Content-Type': 'multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW'}
- body: {'file':'D:/File-Upload/formdata.txt'}
- expected_status: [200]
but i'm getting error:
UnicodeDecodeError: 'unicodeescape' codec can't decode bytes in position 156-157: truncated\UXXXXXXXX escape
How can I test multipart/form-data in pyresttest ?