Best Python code snippet using localstack_python
test_delete_stack.py
Source: test_delete_stack.py
...16 mocked_confirm.return_value = True17 cloudformation = MockedCloudformation()18 cloudformation.stack_name = "testing1"19 cloudformation.stack_details = {"StackStatus": "UPDATE_COMPLETE"}20 delete_stack()21 cloudformation.set_stack.assert_called_once()22 mocked_confirm.assert_called_with(23 "Are you sure you want to delete the stack 'testing1'?"24 )25 cloudformation.client.delete_stack.assert_called_with(StackName="testing1")26 cloudformation.client.wait.assert_not_called()27 delete_stack(wait=True, profile="root", region="us-east-1")28 MockedCloudformation.assert_called_with("root", "us-east-1")29 cloudformation.wait.assert_called_once_with(30 "stack_delete_complete", "Wating for stack to be deleted ..."31 )32 @patch("fzfaws.cloudformation.delete_stack.get_confirmation")33 @patch("fzfaws.cloudformation.delete_stack.Cloudformation")34 def test_retain_delete(self, MockedCloudformation, mocked_confirm):35 mocked_confirm.return_value = True36 cloudformation = MockedCloudformation()37 cloudformation.stack_name = "testing1"38 cloudformation.stack_details = {"StackStatus": "DELETE_FAILED"}39 cloudformation.get_stack_resources.return_value = ["S3Bucket", "OAI"]40 delete_stack()41 cloudformation.set_stack.assert_called_once()42 mocked_confirm.assert_called_with(43 "Are you sure you want to delete the stack 'testing1'?"44 )45 cloudformation.get_stack_resources.assert_called_once_with(46 empty_allow=True,47 header="stack is in the failed state, specify any resource to skip during deletion",48 )49 cloudformation.client.delete_stack.assert_called_with(50 RetainResources=["S3Bucket", "OAI"], StackName="testing1"51 )52 cloudformation.wait.assert_not_called()53 @patch("fzfaws.cloudformation.delete_stack.IAM")54 @patch("fzfaws.cloudformation.delete_stack.get_confirmation")55 @patch("fzfaws.cloudformation.delete_stack.Cloudformation")56 def test_iam_delete(self, MockedCloudformation, mocked_confirm, MockedIAM):57 mocked_confirm.return_value = True58 iam = MockedIAM()59 iam.arns = ["111111"]60 cloudformation = MockedCloudformation()61 cloudformation.stack_name = "testing1"62 cloudformation.stack_details = {"StackStatus": "CREATE_COMPLETE"}63 delete_stack(iam=True)64 iam.set_arns.assert_called_once_with(65 header="select a iam role with permissions to delete the current stack",66 service="cloudformation.amazonaws.com",67 )68 cloudformation.client.delete_stack.assert_called_with(69 RoleARN="111111", StackName="testing1"70 )71 iam.set_arns.reset_mock()72 delete_stack(iam="222222")73 iam.set_arns.assert_not_called()74 cloudformation.client.delete_stack.assert_called_with(75 RoleARN="222222", StackName="testing1"...
partial_environment_destroy.py
Source: partial_environment_destroy.py
...10 self.environment_name = environment_name11 def run(self):12 _logger.info('deleting stacks...')13 cfn_client = boto3.client('cloudformation')14 cfn_client.delete_stack(StackName='dart-%s-subscription-worker-v1' % self.environment_name)15 cfn_client.delete_stack(StackName='dart-%s-trigger-worker-v1' % self.environment_name)16 cfn_client.delete_stack(StackName='dart-%s-engine-worker-v1' % self.environment_name)17 cfn_client.delete_stack(StackName='dart-%s-web-internal-v1' % self.environment_name)18 cfn_client.delete_stack(StackName='dart-%s-web-v1' % self.environment_name)19 cfn_client.delete_stack(StackName='dart-%s-engine-taskrunner-v1' % self.environment_name)20 cfn_client.delete_stack(StackName='dart-%s-elb-internal-v1' % self.environment_name)21 cfn_client.delete_stack(StackName='dart-%s-elb-v1' % self.environment_name)22 cfn_client.delete_stack(StackName='dart-%s-rds-v1' % self.environment_name)23 cfn_client.delete_stack(StackName='dart-%s-events-v1' % self.environment_name)24 _logger.info('done')25def parse_args():26 parser = argparse.ArgumentParser()27 parser.add_argument('-n', '--environment-name', action='store', dest='environment_name', required=True)28 return parser.parse_args()29if __name__ == '__main__':30 args = parse_args()...
BG5.py
Source: BG5.py
1s = input()2count = 03while count < 2**64:4 delete_stack = []5 for i in range(len(s)-2):6 if s[i] == s[i+1] and s[i+1]!=s[i+2]:7 delete_stack.append(i+1)8 delete_stack.append(i+2)9 if s[i] != s[i+1] and s[i+1]==s[i+2]:10 delete_stack.append(i+1)11 delete_stack.append(i)12 delete_stack = list(set(delete_stack))13 ss = list(s)14 s = ""15 for i in range(len(ss)):16 if i not in delete_stack:17 s += ss[i]18 if len(s) == 0:19 print("EMPTY")20 break21 if len(delete_stack) == 0:22 print(s)23 break24 25 ...
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!!