Best Python code snippet using localstack_python
test_integration.py
Source:test_integration.py
...38 # create Firehose stream39 stream = firehose.create_delivery_stream(40 DeliveryStreamName=TEST_FIREHOSE_NAME,41 S3DestinationConfiguration={42 'RoleARN': aws_stack.iam_resource_arn('firehose'),43 'BucketARN': aws_stack.s3_bucket_arn(TEST_BUCKET_NAME),44 'Prefix': s3_prefix45 }46 )47 assert stream48 assert TEST_FIREHOSE_NAME in firehose.list_delivery_streams()['DeliveryStreamNames']49 # create target S3 bucket50 s3_resource.create_bucket(Bucket=TEST_BUCKET_NAME)51 # put records52 firehose.put_record(53 DeliveryStreamName=TEST_FIREHOSE_NAME,54 Record={55 'Data': to_bytes(test_data)56 }57 )58 # check records in target bucket59 all_objects = testutil.list_all_s3_objects()60 testutil.assert_objects(json.loads(to_str(test_data)), all_objects)61def test_firehose_kinesis_to_s3():62 kinesis = aws_stack.connect_to_service('kinesis')63 s3_resource = aws_stack.connect_to_resource('s3')64 firehose = aws_stack.connect_to_service('firehose')65 aws_stack.create_kinesis_stream(TEST_STREAM_NAME, delete=True)66 s3_prefix = '/testdata'67 test_data = '{"test": "firehose_data_%s"}' % short_uid()68 # create Firehose stream69 stream = firehose.create_delivery_stream(70 DeliveryStreamType='KinesisStreamAsSource',71 KinesisStreamSourceConfiguration={72 'RoleARN': aws_stack.iam_resource_arn('firehose'),73 'KinesisStreamARN': aws_stack.kinesis_stream_arn(TEST_STREAM_NAME)74 },75 DeliveryStreamName=TEST_FIREHOSE_NAME,76 S3DestinationConfiguration={77 'RoleARN': aws_stack.iam_resource_arn('firehose'),78 'BucketARN': aws_stack.s3_bucket_arn(TEST_BUCKET_NAME),79 'Prefix': s3_prefix80 }81 )82 assert stream83 assert TEST_FIREHOSE_NAME in firehose.list_delivery_streams()['DeliveryStreamNames']84 # create target S3 bucket85 s3_resource.create_bucket(Bucket=TEST_BUCKET_NAME)86 # put records87 kinesis.put_record(88 Data=to_bytes(test_data),89 PartitionKey='testId',90 StreamName=TEST_STREAM_NAME91 )...
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!