MarketSquare / robotframework-aws

Custom Library for Robot Framework to interact with Amazon Cloud Services
MIT License
26 stars 21 forks source link

'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. #6

Closed Madhugr85 closed 5 years ago

Madhugr85 commented 5 years ago

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'

teaglebuilt commented 5 years ago

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}
teaglebuilt commented 5 years ago

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.

Madhugr85 commented 5 years ago

It worked for me. Thank you Dillan.