MarketSquare/robotframework-aws

'Upload file' keyword is not uploading a file to path name supplied to @param: `key`, instead it's uploading file with name 'foldername/filename' in to the bucket.

Closed this issue · 3 comments

We have requirement, where we need to upload files to user's specific folder in S3 bucket. Using 'Upload File' keyword, uploaded a file, test case succeeded without any issue.

*** Settings ***
Library AWSLibrary

*** Test Cases ***
Upload file to S3 folder
${uploadKey} Set variable s3FolderName\file.mov
${uploadpath} Set variable ${EXECDIR}\localFolderName\localFileName.mov
Create Session With Keys bucketName TestAccessKey TestsecretKey
Upload File bucketName ${uploadKey} ${uploadPath}

But file has not been uploaded to user's specific folder. Instead it uploaded a file to bucket name with filename as 'foldername\filename'.

Expected result: This keyword must upload file with name 'file.mov' to 's3FolderName' folder in the bucket 'bucketName' .

**Actual result:**This keyword, uploaded file with name 's3FolderName\file.mov' to S3 bucket 'bucketName'

So S3 requires unix path. This example below will suffice.

Upload file to S3 folder
      ${uploadKey}    Set variable    ${s3FolderName}/folder_file_test.html
      ${uploadpath}    Set variable    ${EXECDIR}/static/test.html
      Create Session With Keys    ${REGION}  ${ACCESS_KEY}  ${SECRET_KEY}
      Upload File    ${BUCKET}    ${uploadKey}    ${uploadPath}

With that said I think thats a great idea to add an exception in the keyword that fails if the path does not match what is needed. I will work on adding visibility into the keywords for all possible execptions to the user.

It worked for me. Thank you Dillan.