0

In my code there is a method which get csv files from s3 bucket. i need to mock that object in my test file. Below is the source function

s3 = boto3.client('s3')
def method():
    ...
    obj = s3.get_object(bucket, key)
    csv_content = obj['Body'].read().decode('utf-8')
    ...

I need to mock above 'obj'. Do i need to use separate modules? please suggest your thoughts

ahkam
  • 607
  • 7
  • 24

1 Answers1

0

Moto is the common package used in python to mock S3 and some other AWS services.

https://github.com/spulec/moto

Coin Graham
  • 1,343
  • 3
  • 11