Best Python code snippet using localstack_python
test_internet_gateways.py
Source: test_internet_gateways.py
...128 VpcId=self.vpc_id,129 InternetGatewayId=gw_id)130 time.sleep(2)131 # NOTE(andrey-mp): by real id132 data = self.client.describe_internet_gateways(133 InternetGatewayIds=[gw_id])134 self.assertEqual(1, len(data['InternetGateways']))135 # NOTE(andrey-mp): by fake id136 self.assertRaises('InvalidInternetGatewayID.NotFound',137 self.client.describe_internet_gateways,138 InternetGatewayIds=['igw-0'])139 data = self.client.detach_internet_gateway(VpcId=self.vpc_id,140 InternetGatewayId=gw_id)141 data = self.client.delete_internet_gateway(InternetGatewayId=gw_id)142 self.cancelResourceCleanUp(res_clean)143 @decorators.idempotent_id('3f141c56-9ee6-46bf-9c14-0d922ed8a482')144 def test_describe_internet_gateways_filters(self):145 # NOTE(andrey-mp): by filter real vpc-id before creation146 data = self.client.describe_internet_gateways(147 Filters=[{'Name': 'attachment.vpc-id', 'Values': [self.vpc_id]}])148 self.assertEqual(0, len(data['InternetGateways']))149 data = self.client.create_internet_gateway()150 gw_id = data['InternetGateway']['InternetGatewayId']151 res_clean = self.addResourceCleanUp(152 self.client.delete_internet_gateway, InternetGatewayId=gw_id)153 self.assertEmpty(data['InternetGateway'].get('Attachments', []))154 data = self.client.attach_internet_gateway(VpcId=self.vpc_id,155 InternetGatewayId=gw_id)156 self.addResourceCleanUp(self.client.detach_internet_gateway,157 VpcId=self.vpc_id,158 InternetGatewayId=gw_id)159 time.sleep(2)160 # NOTE(andrey-mp): by filter real vpc-id161 data = self.client.describe_internet_gateways(162 Filters=[{'Name': 'attachment.vpc-id', 'Values': [self.vpc_id]}])163 self.assertEqual(1, len(data['InternetGateways']))164 self.assertEqual(gw_id,165 data['InternetGateways'][0]['InternetGatewayId'])166 # NOTE(andrey-mp): by filter fake vpc-id167 data = self.client.describe_internet_gateways(168 Filters=[{'Name': 'attachment.vpc-id', 'Values': ['vpc-0']}])169 self.assertEqual(0, len(data['InternetGateways']))170 # NOTE(andrey-mp): by fake filter171 self.assertRaises('InvalidParameterValue',172 self.client.describe_internet_gateways,173 Filters=[{'Name': 'fake', 'Values': ['fake']}])174 data = self.client.detach_internet_gateway(VpcId=self.vpc_id,175 InternetGatewayId=gw_id)176 data = self.client.delete_internet_gateway(InternetGatewayId=gw_id)...
payload.py
Source: payload.py
...11def describe_route_tables(region, account):12 client = boto3.client('ec2', region_name=region, **account.credentials)13 paganator = util.paginate(client, client.describe_route_tables)14 return dict(RouteTables=[resource for resource in paganator])15def describe_internet_gateways(region, account):16 client = boto3.client('ec2', region_name=region, **account.credentials)17 paganator = util.paginate(client, client.describe_internet_gateways)18 return dict(InternetGateways=[resource for resource in paganator])19def describe_nat_gateways(region, account):20 client = boto3.client('ec2', region_name=region, **account.credentials)21 paganator = util.paginate(client, client.describe_nat_gateways)22 return dict(NatGateways=[resource for resource in paganator])23def network_data(region, account):24 '''25 The repetition within this function suggests using a loop whcih26 traverses a list of dictionary: {cmd: describe_vpcs, label: Vpcs}27 '''28 network_data = {}29 client = boto3.client('ec2', region_name=region, **account.credentials)...
test_internet_gateway.py
Source: test_internet_gateway.py
...11 def test_create_internet_gateway(self):12 ec2_client = boto3.client('ec2')13 vpc = create_vpc(name='Test', cidr_block='10.0.0.0/16')14 internet_gateway = create_internet_gateway(name='TestGateway', vpc_id=vpc.id)15 internet_gateways = ec2_client.describe_internet_gateways(InternetGatewayIds=[internet_gateway.id])['InternetGateways']16 found_internet_gateway = internet_gateways[0]17 self.assertEqual(internet_gateway.id, found_internet_gateway['InternetGatewayId'])18 self.assertEqual(internet_gateway.attachments[0]['VpcId'], found_internet_gateway['Attachments'][0]['VpcId'])19 @moto.mock_ec220 def test_delete_internet_gateway(self):21 ec2_client = boto3.client('ec2')22 vpc = create_vpc(name='Test', cidr_block='10.0.0.0/16')23 internet_gateway = create_internet_gateway(name='TestGateway', vpc_id=vpc.id)24 internet_gateways = ec2_client.describe_internet_gateways(InternetGatewayIds=[internet_gateway.id])['InternetGateways']25 found_internet_gateway = internet_gateways[0]26 self.assertIn(internet_gateway.id, found_internet_gateway['InternetGatewayId'])27 delete_internet_gateway(internet_gateway_id=internet_gateway.id)28 internet_gateways = ec2_client.describe_internet_gateways()['InternetGateways']29 internet_gateway_ids = [internet_gateway['InternetGatewayId'] for internet_gateway in internet_gateways]...
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!!