Used to start a S3 object storage dependency.
- Name: s3
- Dev Port: 9000
- Username: admin123
- Password: admin123
N/A
---
buckets:
- name: mybucket
objects:
- name: foo.csv
content-type: text/csv
path: ./s3/foo.csv
- name: test/bar.png
content-type: image/png
path: ./s3/bar.png
# Create a bucket
self.deps.s3.setup().create_bucket('bucket_name')
# Put an object in a bucket
self.deps.s3.setup().put_object('bucket_name', 'object_name', data)
# Verify an object exists in a bucket
result: bool = self.deps.s3.verify().object_exists('bucket_name', 'object_name')
If you are performing filesystem operations in your test code, you must join with get_base_path
when referring to file paths. This returns the path to the "defaults" folder. For example:
path = os.path.join(self.deps.s3.get_base_path(), './s3/foo.csv')
with open(path, 'rb') as data:
return bytes(data.read())