Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def mocked_s3_bucket():
"""Create a bucket for testing using moto."""
with mock_s3():
conn = s3fs.core.boto3.client("s3", **AWS_CREDENTIALS)
conn.create_bucket(Bucket=BUCKET_NAME)
yield conn
def mocked_s3_bucket():
"""Create a bucket for testing using moto."""
with mock_s3():
conn = s3fs.core.boto3.client("s3", **AWS_CREDENTIALS)
conn.create_bucket(Bucket=BUCKET_NAME)
yield conn
"Id": "PutObjPolicy",
"Statement": [
{
"Sid": "DenyUnEncryptedObjectUploads",
"Effect": "Deny",
"Principal": "*",
"Action": "s3:PutObject",
"Resource": "arn:aws:s3:::{}/*".format(BUCKET_NAME),
"Condition": {"Null": {"s3:x-amz-server-side-encryption": "aws:kms"}},
}
],
}
bucket_policy = json.dumps(bucket_policy)
with mock_s3():
conn = s3fs.core.boto3.client("s3", **AWS_CREDENTIALS)
conn.create_bucket(Bucket=BUCKET_NAME)
conn.put_bucket_policy(Bucket=BUCKET_NAME, Policy=bucket_policy)
yield conn
def mocked_s3_bucket():
"""Create a bucket for testing using moto."""
with mock_s3():
conn = s3fs.core.boto3.client("s3")
conn.create_bucket(Bucket=BUCKET_NAME)
yield conn
def mocked_s3_bucket():
"""Create a bucket for testing using moto."""
with mock_s3():
conn = s3fs.core.boto3.client("s3", **AWS_CREDENTIALS)
conn.create_bucket(Bucket=BUCKET_NAME)
yield conn
def mocked_s3_bucket():
"""Create a bucket for testing using moto."""
with mock_s3():
conn = s3fs.core.boto3.client("s3", **AWS_CREDENTIALS)
conn.create_bucket(Bucket=BUCKET_NAME)
yield conn
def mocked_s3_bucket():
"""Create a bucket for testing using moto."""
with mock_s3():
conn = s3fs.core.boto3.client("s3", **AWS_CREDENTIALS)
conn.create_bucket(Bucket=BUCKET_NAME)
yield conn