s3fixtures v0.1.1
S3Fixtures
Quickly create an S3 environment with buckets and objects in them to create unit tests.
Use npm install --save-dev s3fixtures
to install this module.
Prerequisits
Make sure you have a local S3 server running. You can use Moto for this:
Install:
pip install moto
Run the server
moto_server s3 -p 4568
And note the port
Setup and teardown
This module contains two functions: one to set up the fixtures and one to delete them again. For the buckets, create a buckets.json file like the file in this test folder (an array with params for the createBucket API call). For all objects that need to go in the buckets, create an array like this:
[
[ './object/location.xyz': 'bucketName' ],
...
]
Then use the setup function like this:
s3fixtures.setup('./buckets.json', objectsArray, port, callback)
Once done, use:
s3fixtures.teardown()
This function empties and deletes all buckets.