How to use test_bucket_versioning method in localstack

Best Python code snippet using localstack_python

test_aws.py

Source:test_aws.py Github

copy

Full Screen

1import markwrap.aws as aws2import json3import os4import logging5import botocore6import boto37import filecmp8from moto import mock_sns9from moto import mock_sqs10from moto import mock_s311import pytest12import shutil13import markwrap.test.constants as tstconst14os.environ['AWS_ACCESS_KEY_ID'] = 'testing'15os.environ['AWS_SECRET_ACCESS_KEY'] = 'testing'16os.environ['AWS_SECURITY_TOKEN'] = 'testing'17os.environ['AWS_SESSION_TOKEN'] = 'testing'18@mock_s319def test_upload(caplog, tmp_path):20 caplog.set_level(logging.DEBUG)21 TMP_DIR = tmp_path / "tst.resources"22 shutil.copytree(tstconst.TEST_RESOURCES_DIR, TMP_DIR)23 HAPPY_PATH_BUCKET = "test.bucket"24 HAPPY_PATH_KEY = "test/object"25 HAPPY_PATH_FILEPATH = TMP_DIR / tstconst.EXISTING_FILE26 HAPPY_PATH_VERIFICATION_FILE = TMP_DIR / tstconst.NONEXISTENT_FILE27 ERROR_RELATIVE_FILEPATH = tstconst.EXISTING_FILE28 ERROR_NON_EXISTENT_FILE = TMP_DIR / tstconst.NONEXISTENT_FILE29 ERROR_EMPTY_FILE = TMP_DIR / tstconst.EMPTY_FILE30 ERROR_NON_EXISTENT_BUCKET = "does.not.exist"31 s3 = aws.S3('testing', 'testing')32 caplog.clear()33## INVALID INPUT34 with pytest.raises(RuntimeError):35 s3.upload(None, HAPPY_PATH_KEY, HAPPY_PATH_FILEPATH)36 lines = caplog.text.splitlines()37 assert len(lines) == 238 assert lines[0] == "[INFO] aws.upload - Parameters: bucket=[" + str(None) + "] key=[" + str(HAPPY_PATH_KEY) + "] filepath=[" + str(HAPPY_PATH_FILEPATH) + "]"39 assert lines[1] == "[ERROR] check.nonNone - can NOT be None: None"40 caplog.clear()41 with pytest.raises(RuntimeError):42 s3.upload("", HAPPY_PATH_KEY, HAPPY_PATH_FILEPATH)43 lines = caplog.text.splitlines()44 assert len(lines) == 245 assert lines[0] == "[INFO] aws.upload - Parameters: bucket=[" + str("") + "] key=[" + str(HAPPY_PATH_KEY) + "] filepath=[" + str(HAPPY_PATH_FILEPATH) + "]"46 assert lines[1] == "[ERROR] check.nonEmptyString - string cannot be empty: "47 caplog.clear()48 with pytest.raises(RuntimeError):49 s3.upload(HAPPY_PATH_BUCKET, None, HAPPY_PATH_FILEPATH)50 lines = caplog.text.splitlines()51 assert len(lines) == 252 assert lines[0] == "[INFO] aws.upload - Parameters: bucket=[" + str(HAPPY_PATH_BUCKET) + "] key=[" + str(None) + "] filepath=[" + str(HAPPY_PATH_FILEPATH) + "]"53 assert lines[1] == "[ERROR] check.nonNone - can NOT be None: None"54 caplog.clear()55 with pytest.raises(RuntimeError):56 s3.upload(HAPPY_PATH_BUCKET, "", HAPPY_PATH_FILEPATH)57 lines = caplog.text.splitlines()58 assert len(lines) == 259 assert lines[0] == "[INFO] aws.upload - Parameters: bucket=[" + str(HAPPY_PATH_BUCKET) + "] key=[" + str("") + "] filepath=[" + str(HAPPY_PATH_FILEPATH) + "]"60 assert lines[1] == "[ERROR] check.nonEmptyString - string cannot be empty: "61 caplog.clear()62 with pytest.raises(RuntimeError):63 s3.upload(HAPPY_PATH_BUCKET, HAPPY_PATH_KEY, ERROR_RELATIVE_FILEPATH)64 lines = caplog.text.splitlines()65 assert len(lines) == 266 assert lines[0] == "[INFO] aws.upload - Parameters: bucket=[" + str(HAPPY_PATH_BUCKET) + "] key=[" + str(HAPPY_PATH_KEY) + "] filepath=[" + str(ERROR_RELATIVE_FILEPATH) + "]"67 assert lines[1] == "[ERROR] check.absolutePath - path must be an absolute path: " + str(ERROR_RELATIVE_FILEPATH)68 caplog.clear()69 with pytest.raises(RuntimeError):70 s3.upload(HAPPY_PATH_BUCKET, HAPPY_PATH_KEY, ERROR_NON_EXISTENT_FILE)71 lines = caplog.text.splitlines()72 assert len(lines) == 273 assert lines[0] == "[INFO] aws.upload - Parameters: bucket=[" + str(HAPPY_PATH_BUCKET) + "] key=[" + str(HAPPY_PATH_KEY) + "] filepath=[" + str(ERROR_NON_EXISTENT_FILE) + "]"74 assert lines[1] == "[ERROR] check.exists - file or directory does not exist: " + str(ERROR_NON_EXISTENT_FILE)75 caplog.clear()76 with pytest.raises(RuntimeError):77 s3.upload(HAPPY_PATH_BUCKET, HAPPY_PATH_KEY, ERROR_EMPTY_FILE)78 lines = caplog.text.splitlines()79 assert len(lines) == 280 assert lines[0] == "[INFO] aws.upload - Parameters: bucket=[" + str(HAPPY_PATH_BUCKET) + "] key=[" + str(HAPPY_PATH_KEY) + "] filepath=[" + str(ERROR_EMPTY_FILE) + "]"81 assert lines[1] == "[ERROR] check.fileSizeNonZero - file size is not greater than zero: " + str(ERROR_EMPTY_FILE) + " (0 bytes)"82 caplog.clear()83## MOCK AWS SETUP84 caplog.set_level(logging.INFO)85 moto_s3 = boto3.resource('s3', region_name=aws.REGION)86 test_bucket = moto_s3.create_bucket(Bucket=HAPPY_PATH_BUCKET, CreateBucketConfiguration={'LocationConstraint': aws.REGION})87 test_bucket_versioning = test_bucket.Versioning()88 test_bucket_versioning.enable()89 moto_s3_client = boto3.client('s3', region_name=aws.REGION)90 moto_s3_client.put_bucket_encryption(Bucket=HAPPY_PATH_BUCKET, ServerSideEncryptionConfiguration={'Rules': [{'ApplyServerSideEncryptionByDefault': {'SSEAlgorithm': 'AES256'}}]})91 moto_s3_client.put_bucket_lifecycle_configuration(Bucket=HAPPY_PATH_BUCKET, LifecycleConfiguration={92 'Rules': [93 {94 'Expiration': {95 'Days': 3650,96 },97 'Filter': {98 'Prefix': '',99 },100 'ID': 'TestOnly',101 'Status': 'Enabled'102 }103 ]104 })105 caplog.clear()106## HAPPY PATH107 s3.upload(HAPPY_PATH_BUCKET, HAPPY_PATH_KEY, HAPPY_PATH_FILEPATH)108 lines = caplog.text.splitlines()109 assert len(lines) == 3110 assert lines[0] == "[INFO] aws.upload - Parameters: bucket=[" + str(HAPPY_PATH_BUCKET) + "] key=[" + str(HAPPY_PATH_KEY) + "] filepath=[" + str(HAPPY_PATH_FILEPATH) + "]"111 assert lines[1] == "[INFO] aws.upload - Uploading filepath " + str(HAPPY_PATH_FILEPATH) + " to S3 bucket " + HAPPY_PATH_BUCKET + " with key " + HAPPY_PATH_KEY112 assert lines[2] == "[INFO] aws.upload - Uploaded filepath " + str(HAPPY_PATH_FILEPATH) + " to S3 bucket " + HAPPY_PATH_BUCKET + " with key " + HAPPY_PATH_KEY113 caplog.clear()114 test_bucket.download_file(HAPPY_PATH_KEY, str(HAPPY_PATH_VERIFICATION_FILE))115 filecmp.cmp(HAPPY_PATH_FILEPATH, HAPPY_PATH_VERIFICATION_FILE, shallow=False)116 os.remove(HAPPY_PATH_VERIFICATION_FILE)117## OVERWRITE FAILURE118 with pytest.raises(RuntimeError):119 s3.upload(HAPPY_PATH_BUCKET, HAPPY_PATH_KEY, HAPPY_PATH_FILEPATH)120 lines = caplog.text.splitlines()121 assert len(lines) == 3122 assert lines[0] == "[INFO] aws.upload - Parameters: bucket=[" + str(HAPPY_PATH_BUCKET) + "] key=[" + str(HAPPY_PATH_KEY) + "] filepath=[" + str(HAPPY_PATH_FILEPATH) + "]"123 assert lines[1] == "[INFO] aws.upload - Uploading filepath " + str(HAPPY_PATH_FILEPATH) + " to S3 bucket " + HAPPY_PATH_BUCKET + " with key " + HAPPY_PATH_KEY124 assert lines[2] == "[ERROR] aws.upload - After uploading filepath " + str(HAPPY_PATH_FILEPATH) + ", multiple versions detected in S3 bucket " + HAPPY_PATH_BUCKET + " for key " + HAPPY_PATH_KEY125 caplog.clear()126## DEPENDENCY FAILURE127 with pytest.raises(boto3.exceptions.S3UploadFailedError):128 s3.upload(ERROR_NON_EXISTENT_BUCKET, HAPPY_PATH_KEY, HAPPY_PATH_FILEPATH)129 lines = caplog.text.splitlines()130 assert len(lines) == 3131 assert lines[0] == "[INFO] aws.upload - Parameters: bucket=[" + str(ERROR_NON_EXISTENT_BUCKET) + "] key=[" + str(HAPPY_PATH_KEY) + "] filepath=[" + str(HAPPY_PATH_FILEPATH) + "]"132 assert lines[1] == "[INFO] aws.upload - Uploading filepath " + str(HAPPY_PATH_FILEPATH) + " to S3 bucket " + ERROR_NON_EXISTENT_BUCKET + " with key " + HAPPY_PATH_KEY133 assert lines[2] == "[ERROR] aws.upload - Fault from AWS S3 calling upload_file! Failed to upload " + str(HAPPY_PATH_FILEPATH) + " to " + ERROR_NON_EXISTENT_BUCKET + "/" + HAPPY_PATH_KEY + ": An error occurred (NoSuchBucket) when calling the PutObject operation: The specified bucket does not exist"134 caplog.clear()135@mock_s3136def test_download(caplog, tmp_path):137 caplog.set_level(logging.DEBUG)138 TMP_DIR = tmp_path / "tst.resources"139 shutil.copytree(tstconst.TEST_RESOURCES_DIR, TMP_DIR)140 HAPPY_PATH_BUCKET = "test.bucket"141 HAPPY_PATH_KEY = "test/object"142 HAPPY_PATH_FILEPATH = TMP_DIR / tstconst.NONEXISTENT_FILE143 HAPPY_PATH_OUTPUT_CONTENT = TMP_DIR / tstconst.EXISTING_FILE144 ERROR_RELATIVE_FILEPATH = tstconst.EXISTING_FILE145 ERROR_EXISTING_FILE = TMP_DIR / tstconst.EXISTING_FILE146 ERROR_NON_EXISTENT_BUCKET = "does.not.exist"147 ERROR_NON_EXISTENT_KEY = "does/not/exist"148 s3 = aws.S3('testing', 'testing')149 caplog.clear()150## INVALID INPUT151 with pytest.raises(RuntimeError):152 s3.download(None, HAPPY_PATH_KEY, HAPPY_PATH_FILEPATH)153 lines = caplog.text.splitlines()154 assert len(lines) == 2155 assert lines[0] == "[INFO] aws.download - Parameters: bucket=[" + str(None) + "] key=[" + str(HAPPY_PATH_KEY) + "] filepath=[" + str(HAPPY_PATH_FILEPATH) + "]"156 assert lines[1] == "[ERROR] check.nonNone - can NOT be None: None"157 caplog.clear()158 with pytest.raises(RuntimeError):159 s3.download(HAPPY_PATH_BUCKET, None, HAPPY_PATH_FILEPATH)160 lines = caplog.text.splitlines()161 assert len(lines) == 2162 assert lines[0] == "[INFO] aws.download - Parameters: bucket=[" + str(HAPPY_PATH_BUCKET) + "] key=[" + str(None) + "] filepath=[" + str(HAPPY_PATH_FILEPATH) + "]"163 assert lines[1] == "[ERROR] check.nonNone - can NOT be None: None"164 caplog.clear()165 with pytest.raises(RuntimeError):166 s3.download(HAPPY_PATH_BUCKET, HAPPY_PATH_KEY, ERROR_RELATIVE_FILEPATH)167 lines = caplog.text.splitlines()168 assert len(lines) == 2169 assert lines[0] == "[INFO] aws.download - Parameters: bucket=[" + str(HAPPY_PATH_BUCKET) + "] key=[" + str(HAPPY_PATH_KEY) + "] filepath=[" + str(ERROR_RELATIVE_FILEPATH) + "]"170 assert lines[1] == "[ERROR] check.absolutePath - path must be an absolute path: " + str(ERROR_RELATIVE_FILEPATH)171 caplog.clear()172 with pytest.raises(RuntimeError):173 s3.download(HAPPY_PATH_BUCKET, HAPPY_PATH_KEY, ERROR_EXISTING_FILE)174 lines = caplog.text.splitlines()175 assert len(lines) == 2176 assert lines[0] == "[INFO] aws.download - Parameters: bucket=[" + str(HAPPY_PATH_BUCKET) + "] key=[" + str(HAPPY_PATH_KEY) + "] filepath=[" + str(ERROR_EXISTING_FILE) + "]"177 assert lines[1] == "[ERROR] check.nonexistent - file or directory already exists: " + str(ERROR_EXISTING_FILE)178 caplog.clear()179## MOCK AWS SETUP180 caplog.set_level(logging.INFO)181 moto_s3 = boto3.resource('s3', region_name=aws.REGION)182 test_bucket = moto_s3.create_bucket(Bucket=HAPPY_PATH_BUCKET, CreateBucketConfiguration={'LocationConstraint': aws.REGION})183 test_bucket_versioning = test_bucket.Versioning()184 test_bucket_versioning.enable()185 moto_s3_client = boto3.client('s3', region_name=aws.REGION)186 moto_s3_client.put_bucket_encryption(Bucket=HAPPY_PATH_BUCKET, ServerSideEncryptionConfiguration={'Rules': [{'ApplyServerSideEncryptionByDefault': {'SSEAlgorithm': 'AES256'}}]})187 moto_s3_client.put_bucket_lifecycle_configuration(Bucket=HAPPY_PATH_BUCKET, LifecycleConfiguration={188 'Rules': [189 {190 'Expiration': {191 'Days': 3650,192 },193 'Filter': {194 'Prefix': '',195 },196 'ID': 'TestOnly',197 'Status': 'Enabled'198 }199 ]200 })201 caplog.clear()202## HAPPY PATH203 test_bucket.upload_file(str(HAPPY_PATH_OUTPUT_CONTENT), HAPPY_PATH_KEY)204 s3.download(HAPPY_PATH_BUCKET, HAPPY_PATH_KEY, HAPPY_PATH_FILEPATH)205 filecmp.cmp(HAPPY_PATH_FILEPATH, HAPPY_PATH_OUTPUT_CONTENT, shallow=False)206 lines = caplog.text.splitlines()207 assert len(lines) == 3208 assert lines[0] == "[INFO] aws.download - Parameters: bucket=[" + str(HAPPY_PATH_BUCKET) + "] key=[" + str(HAPPY_PATH_KEY) + "] filepath=[" + str(HAPPY_PATH_FILEPATH) + "]"209 assert lines[1] == "[INFO] aws.download - Downloading key " + HAPPY_PATH_KEY + " from S3 bucket " + HAPPY_PATH_BUCKET + " to filepath " + str(HAPPY_PATH_FILEPATH)210 assert lines[2] == "[INFO] aws.download - Downloaded key " + HAPPY_PATH_KEY + " from S3 bucket " + HAPPY_PATH_BUCKET + " to filepath " + str(HAPPY_PATH_FILEPATH)211 caplog.clear()212 os.remove(HAPPY_PATH_FILEPATH)213## DEPENDENCY FAILURE214 with pytest.raises(botocore.exceptions.ClientError):215 s3.download(ERROR_NON_EXISTENT_BUCKET, HAPPY_PATH_KEY, HAPPY_PATH_FILEPATH)216 lines = caplog.text.splitlines()217 assert len(lines) == 5218 assert lines[0] == "[INFO] aws.download - Parameters: bucket=[" + str(ERROR_NON_EXISTENT_BUCKET) + "] key=[" + str(HAPPY_PATH_KEY) + "] filepath=[" + str(HAPPY_PATH_FILEPATH) + "]"219 assert lines[1] == "[INFO] aws.download - Downloading key " + HAPPY_PATH_KEY + " from S3 bucket " + ERROR_NON_EXISTENT_BUCKET + " to filepath " + str(HAPPY_PATH_FILEPATH)220 assert lines[2] == "[ERROR] aws.download - Fault from AWS S3 calling download_file! An error occurred (NoSuchBucket) when calling the HeadObject operation: The specified bucket does not exist"221 assert lines[3].startswith("[ERROR] aws.download - Fault from AWS S3 calling download_file! Error: {'Code': 'NoSuchBucket', 'Message': 'The specified bucket does not exist', 'BucketName': 'does.not.exist', 'RequestID': ")222 assert lines[4] == "[ERROR] aws.download - Fault from AWS S3 calling download_file! ResponseMetadata: {'HTTPStatusCode': 404, 'HTTPHeaders': {}, 'RetryAttempts': 0}"223 caplog.clear()224 with pytest.raises(botocore.exceptions.ClientError):225 s3.download(HAPPY_PATH_BUCKET, ERROR_NON_EXISTENT_KEY, HAPPY_PATH_FILEPATH)226 lines = caplog.text.splitlines()227 assert len(lines) == 5228 assert lines[0] == "[INFO] aws.download - Parameters: bucket=[" + str(HAPPY_PATH_BUCKET) + "] key=[" + str(ERROR_NON_EXISTENT_KEY) + "] filepath=[" + str(HAPPY_PATH_FILEPATH) + "]"229 assert lines[1] == "[INFO] aws.download - Downloading key " + ERROR_NON_EXISTENT_KEY + " from S3 bucket " + HAPPY_PATH_BUCKET + " to filepath " + str(HAPPY_PATH_FILEPATH)230 assert lines[2] == "[ERROR] aws.download - Fault from AWS S3 calling download_file! An error occurred (404) when calling the HeadObject operation: Not Found"231 assert lines[3] == "[ERROR] aws.download - Fault from AWS S3 calling download_file! Error: {'Code': '404', 'Message': 'Not Found'}"232 assert lines[4] == "[ERROR] aws.download - Fault from AWS S3 calling download_file! ResponseMetadata: {'RequestId': '', 'HostId': '', 'HTTPStatusCode': 404, 'HTTPHeaders': {}, 'RetryAttempts': 0}"233 caplog.clear()234@mock_sns235@mock_sqs236def test_sns_publish(caplog):237 caplog.set_level(logging.DEBUG)238 HAPPY_PATH_TOPIC_NAME = "TestTopic"239 HAPPY_PATH_TOPIC_ARN = "arn:aws:sns:us-east-2:123456789012:" + HAPPY_PATH_TOPIC_NAME240 HAPPY_PATH_MESSAGE = "Test Message"241 ERROR_BAD_TOPIC_ARN = "arn:aws::us-east-2:123456789012:TestTopic"242 ERROR_NON_EXISTENT_TOPIC_ARN = "arn:aws:sns:us-east-2:123456789012:DoesNotExist"243 sns = aws.SNS('testing', 'testing')244 caplog.clear()245## INVALID INPUT246 with pytest.raises(RuntimeError):247 sns.publish(None, HAPPY_PATH_MESSAGE)248 lines = caplog.text.splitlines()249 assert len(lines) == 2250 assert lines[0] == "[INFO] aws.publish - Parameters: topic_arn=[" + str(None) + "] message=[" + str(HAPPY_PATH_MESSAGE) + "]"251 assert lines[1] == "[ERROR] check.nonNone - can NOT be None: None"252 caplog.clear()253 with pytest.raises(RuntimeError):254 sns.publish(HAPPY_PATH_TOPIC_ARN, None)255 lines = caplog.text.splitlines()256 assert len(lines) == 2257 assert lines[0] == "[INFO] aws.publish - Parameters: topic_arn=[" + str(HAPPY_PATH_TOPIC_ARN) + "] message=[" + str(None) + "]"258 assert lines[1] == "[ERROR] check.nonNone - can NOT be None: None"259 caplog.clear()260 with pytest.raises(RuntimeError):261 sns.publish(ERROR_BAD_TOPIC_ARN, HAPPY_PATH_MESSAGE)262 lines = caplog.text.splitlines()263 assert len(lines) == 2264 assert lines[0] == "[INFO] aws.publish - Parameters: topic_arn=[" + str(ERROR_BAD_TOPIC_ARN) + "] message=[" + str(HAPPY_PATH_MESSAGE) + "]"265 assert lines[1] == "[ERROR] aws.publish - topic_arn must match the AWS arn format: " + str(ERROR_BAD_TOPIC_ARN)266 caplog.clear()267## MOCK AWS SETUP268 caplog.set_level(logging.INFO)269 moto_sns = boto3.resource('sns', region_name=aws.REGION)270 test_topic = moto_sns.create_topic(Name=HAPPY_PATH_TOPIC_NAME)271 moto_sqs = boto3.client('sqs', region_name=aws.REGION)272 test_queue_url = moto_sqs.create_queue(QueueName="test_queue")["QueueUrl"]273 test_queue_arn = moto_sqs.get_queue_attributes(QueueUrl=test_queue_url, AttributeNames=["QueueArn"])["Attributes"]["QueueArn"]274 test_topic.subscribe(Protocol='sqs', Endpoint=test_queue_arn)275 caplog.clear()276## HAPPY PATH277 sns.publish(HAPPY_PATH_TOPIC_ARN, HAPPY_PATH_MESSAGE)278 lines = caplog.text.splitlines()279 assert len(lines) == 3280 assert lines[0] == "[INFO] aws.publish - Parameters: topic_arn=[" + str(HAPPY_PATH_TOPIC_ARN) + "] message=[" + str(HAPPY_PATH_MESSAGE) + "]"281 assert lines[1] == "[INFO] aws.publish - Publishing message " + str(HAPPY_PATH_MESSAGE) + " to SNS topic " + str(HAPPY_PATH_TOPIC_ARN)282 assert lines[2].startswith("[INFO] aws.publish - Published message " + str(HAPPY_PATH_MESSAGE) + " to SNS topic " + str(HAPPY_PATH_TOPIC_ARN) + " with messageId ")283 caplog.clear()284 messages = moto_sqs.receive_message(QueueUrl=test_queue_url)["Messages"]285 assert len(messages) == 1286 sns_notification = json.loads(messages[0]["Body"])287 assert HAPPY_PATH_TOPIC_ARN == sns_notification["TopicArn"]288 assert HAPPY_PATH_MESSAGE == sns_notification["Message"]289## DEPENDENCY FAILURE290 with pytest.raises(botocore.exceptions.ClientError):291 sns.publish(ERROR_NON_EXISTENT_TOPIC_ARN, HAPPY_PATH_MESSAGE)292 lines = caplog.text.splitlines()293 assert len(lines) == 5294 assert lines[0] == "[INFO] aws.publish - Parameters: topic_arn=[" + str(ERROR_NON_EXISTENT_TOPIC_ARN) + "] message=[" + str(HAPPY_PATH_MESSAGE) + "]"295 assert lines[1] == "[INFO] aws.publish - Publishing message " + str(HAPPY_PATH_MESSAGE) + " to SNS topic " + str(ERROR_NON_EXISTENT_TOPIC_ARN)296 assert lines[2] == "[ERROR] aws.publish - Fault from AWS SNS calling topic.publish! An error occurred (NotFound) when calling the Publish operation: Endpoint with arn arn:aws:sns:us-east-2:123456789012:DoesNotExist not found"297 assert lines[3] == "[ERROR] aws.publish - Fault from AWS SNS calling topic.publish! Error: {'Code': 'NotFound', 'Message': 'Endpoint with arn arn:aws:sns:us-east-2:123456789012:DoesNotExist not found'}"298 assert lines[4] == "[ERROR] aws.publish - Fault from AWS SNS calling topic.publish! ResponseMetadata: {'HTTPStatusCode': 404, 'HTTPHeaders': {'server': 'amazon.com', 'status': '404'}, 'RetryAttempts': 0}"...

Full Screen

Full Screen

test_cloudformation_s3.py

Source:test_cloudformation_s3.py Github

copy

Full Screen

...26 descr_response = cfn_client.describe_stacks(StackName=result.stack_id)27 output = descr_response["Stacks"][0]["Outputs"][0]28 assert output["OutputKey"] == "BucketNameOutput"29 assert result.stack_name.lower() in output["OutputValue"]30def test_bucket_versioning(cfn_client, deploy_cfn_template, s3_client):31 result = deploy_cfn_template(template_file_name="s3_versioned_bucket.yaml")32 assert "BucketName" in result.outputs33 bucket_name = result.outputs["BucketName"]34 bucket_version = s3_client.get_bucket_versioning(Bucket=bucket_name)...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run localstack automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful