Best Python code snippet using localstack_python
test_integration.py
Source: test_integration.py
...219 # this can take a long time in CI, make sure we give it enough time/retries220 retry(check_events, retries=7, sleep=3)221 # make sure the we have the right amount of INSERT/MODIFY event types222 # check cloudwatch notifications223 num_invocations = get_lambda_invocations_count(TEST_LAMBDA_NAME_STREAM)224 assert num_invocations == 2 + num_events_lambda225 num_error_invocations = get_lambda_invocations_count(TEST_LAMBDA_NAME_STREAM, 'Errors')226 assert num_error_invocations == 1227def test_kinesis_lambda_forward_chain():228 kinesis = aws_stack.connect_to_service('kinesis')229 s3 = aws_stack.connect_to_service('s3')230 aws_stack.create_kinesis_stream(TEST_CHAIN_STREAM1_NAME, delete=True)231 aws_stack.create_kinesis_stream(TEST_CHAIN_STREAM2_NAME, delete=True)232 s3.create_bucket(Bucket=TEST_BUCKET_NAME)233 # deploy test lambdas connected to Kinesis streams234 zip_file = testutil.create_lambda_archive(load_file(TEST_LAMBDA_PYTHON), get_content=True,235 libs=TEST_LAMBDA_LIBS, runtime=LAMBDA_RUNTIME_PYTHON27)236 testutil.create_lambda_function(func_name=TEST_CHAIN_LAMBDA1_NAME, zip_file=zip_file,237 event_source_arn=get_event_source_arn(TEST_CHAIN_STREAM1_NAME), runtime=LAMBDA_RUNTIME_PYTHON27)238 testutil.create_lambda_function(func_name=TEST_CHAIN_LAMBDA2_NAME, zip_file=zip_file,239 event_source_arn=get_event_source_arn(TEST_CHAIN_STREAM2_NAME), runtime=LAMBDA_RUNTIME_PYTHON27)240 # publish test record241 test_data = {'test_data': 'forward_chain_data_%s' % short_uid()}242 data = clone(test_data)243 data[lambda_integration.MSG_BODY_MESSAGE_TARGET] = 'kinesis:%s' % TEST_CHAIN_STREAM2_NAME244 kinesis.put_record(Data=to_bytes(json.dumps(data)), PartitionKey='testId', StreamName=TEST_CHAIN_STREAM1_NAME)245 # check results246 time.sleep(5)247 all_objects = testutil.list_all_s3_objects()248 testutil.assert_objects(test_data, all_objects)249# ---------------250# HELPER METHODS251# ---------------252def get_event_source_arn(stream_name):253 kinesis = aws_stack.connect_to_service('kinesis')254 return kinesis.describe_stream(StreamName=stream_name)['StreamDescription']['StreamARN']255def get_lambda_invocations_count(lambda_name, metric=None):256 return get_lambda_metrics(lambda_name, metric)['Datapoints'][-1]['Sum']257def get_lambda_metrics(func_name, metric=None):258 metric = metric or 'Invocations'259 cloudwatch = aws_stack.connect_to_service('cloudwatch')260 return cloudwatch.get_metric_statistics(261 Namespace='AWS/Lambda',262 MetricName=metric,263 Dimensions=[{'Name': 'FunctionName', 'Value': func_name}],264 Period=60,265 StartTime=datetime.now() - timedelta(minutes=1),266 EndTime=datetime.now(),267 Statistics=['Sum']...
Check out the latest blogs from LambdaTest on this topic:
The fact is not alien to us anymore that cross browser testing is imperative to enhance your application’s user experience. Enhanced knowledge of popular and highly acclaimed testing frameworks goes a long way in developing a new app. It holds more significance if you are a full-stack developer or expert programmer.
QA testers have a unique role and responsibility to serve the customer. Serving the customer in software testing means protecting customers from application defects, failures, and perceived failures from missing or misunderstood requirements. Testing for known requirements based on documentation or discussion is the core of the testing profession. One unique way QA testers can both differentiate themselves and be innovative occurs when senseshaping is used to improve the application user experience.
Having a good web design can empower business and make your brand stand out. According to a survey by Top Design Firms, 50% of users believe that website design is crucial to an organization’s overall brand. Therefore, businesses should prioritize website design to meet customer expectations and build their brand identity. Your website is the face of your business, so it’s important that it’s updated regularly as per the current web design trends.
Enterprise resource planning (ERP) is a form of business process management software—typically a suite of integrated applications—that assists a company in managing its operations, interpreting data, and automating various back-office processes. The introduction of a new ERP system is analogous to the introduction of a new product into the market. If the product is not handled appropriately, it will fail, resulting in significant losses for the business. Most significantly, the employees’ time, effort, and morale would suffer as a result of the procedure.
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!!