I seem to recall reading about an Amazon S3-compatible test server that you could run on your own server for unit tests or whatever. However, I've just exhausted my patience looking for this with both Google and AWS. Does such a thing exist? If not, I think I'll write one.
Note: I'm asking about Amazon S3 (the storage system) rather than Amazon EC2 (cloud computing).
Are you thinking of Park Place?
FYI, its old home page is offline now.
I think moto (https://github.com/spulec/moto) is the perfect tool for your unittests. Moto mocks all accesses to S3, SQS, etc. and can be used in any programming language using their web server.
It is trivial to setup, lightweight and fast.
From moto's README:
Imagine you have the following code that you want to test:
import boto
from boto.s3.key import Key
class MyModel(object):
def __init__(self, name, value):
self.name = name
self.value = value
def save(self):
conn = boto.connect_s3()
bucket = conn.get_bucket('mybucket')
k = Key(bucket)
k.key = self.name
k.set_contents_from_string(self.value)
Take a minute to think how you would have tested that in the past. Now see how you could test it with Moto:
import boto
from moto import mock_s3
from mymodule import MyModel
@mock_s3
def test_my_model_save():
model_instance = MyModel('steve', 'is awesome')
model_instance.save()
conn = boto.connect_s3()
assert conn.get_bucket('mybucket').get_key('steve') == 'is awesome'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With