zoukankan      html  css  js  c++  java
  • robotframework接口上传图片

     1     [Arguments]                         ${filePath}=${OTHER_FILE_PATH}
     2     ...                                 ${fileName}=${PHOTO_FILE_NAME}
     3     ...                                 ${fileType}=${JPG_TYPE}
     4     ...                                 ${docLib}=${1}
     5     Create Session                      api    ${ARTICLES_URL}
     6     ${fileContent}      Evaluate       ('${fileName}.${fileType}',open('${filePath}/${fileName}.${fileType}','rb'),'image/${fileType}')
     7     ${fileDict} =                       Create Dictionary   file=${fileContent}
     8     ${bodyData} =                       Create Dictionary   docLib=${docLib}
     9     ${resp} =                           Post Request        api    e5/images/upload     files=${fileDict}   data=${bodyData}
    10     #Log             ${resp}
    11     Should Be Equal As Strings          ${resp.status_code}     200
    12     #Log             ${resp.content}
    13     #Log             ${resp.json()}
    14     ${responsedata}                     to json             ${resp.content}
    15     #Log             ${responsedata}
    16     ${data}                             Get From Dictionary                     ${responsedata}    data
    17     ${PIC_PATH}                         Get From Dictionary                     ${data}            path
    18     # Log             ${PIC_PATH}
    19     Set Suite Variable                  ${PIC_PATH}
  • 相关阅读:
    最大子数组1
    大道至简阅读笔记03
    I-think-3
    第3周学习进度
    大道至简阅读笔记02
    四则运算题3
    大道至简阅读笔记01
    第2周学习进度
    构建之法阅读笔记03
    按Right-BICEP的测试用例
  • 原文地址:https://www.cnblogs.com/Yanss/p/13189007.html
Copyright © 2011-2022 走看看