FileUtils.robot 846 B

1234567891011121314151617
  1. *** Keywords ***
  2. PutRequestFile
  3. [Arguments] ${host} ${path} ${filepath} ${Authorization} ${FileType} ${FileToken}
  4. ${header_dict} Create Dictionary Content-Type=multipart/form-data
  5. Set To Dictionary ${header_dict} Authorization=${Authorization}
  6. Set To Dictionary ${header_dict} FileInfo=FileType=${FileType}&FileToken=${FileToken}
  7. #文件上传测试-POST
  8. Create Session file_upload ${host} verify=True
  9. # 打开文件
  10. ${file_data} Get File For Streaming Upload ${filepath}
  11. # 文件参数
  12. ${file_parts} Create Dictionary
  13. Set To Dictionary ${file_parts} file=${file_data}
  14. # 文件上传参数
  15. ${resp} Put On Session file_upload ${path} files=${file_parts} headers=${header_dict}
  16. Log ${resp}
  17. [Return] ${resp}