Skip to content

An example of how to use stubber to unit test boto3 code

Notifications You must be signed in to change notification settings

justengland/boto-stubber

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

aws boto3 patching example

Use boto stubber to stub out responses from the AWS Api, via the python patch.object functionality. Using the Nose testing framework.

Run example client to pull items from public s3 buckets and sts calls.

./read.py

Run unit tests

python3 -m nose

Testing overview

  1. Do a simple test with the s3 client using boto's stubber functionality
  2. Test a complex function that calls multiple AWS API's, by using patching side effects, returned in a serial array function. which may seem simpler, but may be more brittle if the order of the clients calls changes
  3. Test a complex function that calls multiple AWS API's, by using patching side effects, returned with an inline function. which may seem more complex, but may be less brittle if the order of the clients calls changes

References:

About

An example of how to use stubber to unit test boto3 code

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages