Skip to main content

All Questions

Filter by
Sorted by
Tagged with
0 votes
1 answer
1k views

How to patch Boto3.resource DynamoDb Table within a pytest test method

I'm trying to use this answer as an example to test that a dynamo table is not written to. Because I am using moto to test my reads & writes, I have to do the import inside the test case. I ...
MikeF's user avatar
  • 988
0 votes
0 answers
47 views

How to mock a function which is called several times within a parent function, Python3?

I'm having a function which makes 3 get request to fetch file from S3 bucket. So i need to mock them correctly to return an expected result. Below is the code structure # src.py def parent(bucket, ...
ahkam's user avatar
  • 767
2 votes
0 answers
730 views

Mock Boto3 AWS calls where client is global

I have some code that I am attempting to write unit tests for. I have looked at other answers here e.g. here although I have the problem that the Boto3 client reference is global and outside of the ...
Alex Harvey's user avatar
  • 15.4k
0 votes
0 answers
2k views

Mock unit test for Python boto3 for AWS S3

I'm currently learning how to write unit test for boto3 I'm trying to follow the moto documentation and have written a few lines for the unit test but it gave me error: @mock_s3 def ...
wawawa's user avatar
  • 3,305