python3+robot上传文件

#导入excel关键字
importUserList

[Arguments] ${param}


#${dic} Create Dictionary Content-Disposition=form-data; name="file"; filename="userlistimport.xls" Content-Type=application/vnd.ms-excel Content-Transfer-Encoding=binary

${deleteReq} post request IP:PORT /URL/url/importUserList files=${param} #headers=${header}

log ${deleteReq.content}

should be equal as strings ${deleteReq.status_code} 200
should be byte string ${deleteReq.content} 'success':true


#用例
*** Test Cases ***

#导入用户excel
importUserList
Get session

${files} evaluate {'file': ('report.xls', open(r'D:\\xxxx\\userlistimport.xls', 'rb'), 'application/vnd.ms-excel')}

importUserList ${files}
posted @ 2020-06-01 14:05  定静沉行  阅读(331)  评论(0编辑  收藏  举报