Newer
Older
import boto3
from moto import mock_s3
from cubicweb_s3storage.storages import S3Storage
class S3StorageTestMixin(object):
bucket = 'test-bucket'
def setUp(self):
self.s3_mock = mock_s3()
self.s3_mock.start()
resource = boto3.resource('s3', region_name='somewhere')
self.s3_bucket = resource.create_bucket(Bucket=self.bucket)
self.s3_storage = S3Storage(self.bucket)
super(S3StorageTestMixin, self).setUp()
def tearDown(self):
super(S3StorageTestMixin, self).tearDown()
del self.s3_storage
self.s3_mock.stop()