Best Python code snippet using localstack_python
test_awslambda_actions.py
Source: test_awslambda_actions.py
...52 with patch.object(client, "put_function_concurrency", FailedActivity):53 with pytest.raises(Exception):54 put_function_concurrency(lambda_function_name, concurrency)55@patch("chaosaws.awslambda.actions.aws_client", autospec=True)56def test_aws_lambda_delete_function_concurrency(aws_client):57 client = MagicMock()58 aws_client.return_value = client59 lambda_function_name = "my-lambda-function"60 delete_function_concurrency(lambda_function_name)61 client.delete_function_concurrency.assert_called_with(62 FunctionName=lambda_function_name63 )64@patch("chaosaws.awslambda.actions.aws_client", autospec=True)65def test_aws_lambda_invoke_no_args(aws_client):66 client = MagicMock()67 aws_client.return_value = client68 mock_payload = {"some": "response"}69 mock_response = {"Payload": MagicMock()}70 mock_response["Payload"].read.return_value = json.dumps(mock_payload).encode()71 client.invoke.return_value = mock_response72 lambda_function_name = "my-lambda-function"73 response = invoke_function(lambda_function_name)74 assert response["Payload"] == mock_payload...
actions.py
Source: actions.py
...79 except Exception as x:80 raise FailedActivity(81 f"failed throttling lambda function '{function_name}': '{str(x)}'"82 )83def delete_function_concurrency(84 function_name: str, configuration: Configuration = None, secrets: Secrets = None85) -> AWSResponse:86 """87 Removes concurrency limit applied to the specified Lambda88 """89 client = aws_client("lambda", configuration, secrets)90 return client.delete_function_concurrency(FunctionName=function_name)91def put_function_timeout(92 function_name: str,93 timeout: int,94 configuration: Configuration = None,95 secrets: Secrets = None,96) -> AWSResponse:97 """98 Sets the function timeout.99 Input timeout argument is specified in seconds.100 """101 client = aws_client("lambda", configuration, secrets)102 return _update_function_configuration(103 function_name=function_name, client=client, timeout=timeout104 )...
dss-start-stop--think-before-you-invoke-me.py
...32 lambda_client.put_function_concurrency(FunctionName=name, ReservedConcurrentExecutions=0)33 print(f"halted {name}")34 35def enable_lambda(name):36 lambda_client.delete_function_concurrency(FunctionName=name)37 print(f"started {name}")38root, dirs, files = next(os.walk(os.path.join(pkg_root, 'daemons')))39functions = [f'{name}-{stage}' for name in dirs]40functions.append(f"dss-{stage}") 41for f in functions:42 try:43 resp = lambda_client.get_function(FunctionName=f)44 except lambda_client.exceptions.ResourceNotFoundException:45 print(f"{f} not deployed, or does not deploy a Lambda function")46 continue47 if "start" == args.action:48 enable_lambda(f)49 elif "stop" == args.action:50 disable_lambda(f)...
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!!