Best Python code snippet using localstack_python
route53.py
Source: route53.py
...7 description = "Route53 Hosted Zones per Account"8 scope = QuotaScope.ACCOUNT9 @property10 def maximum(self):11 return self.boto_session.client('route53').get_account_limit(Type='MAX_HOSTED_ZONES_BY_OWNER')['Limit']['Value']12 @property13 def current(self):14 return self.boto_session.client('route53').get_account_limit(Type='MAX_HOSTED_ZONES_BY_OWNER')['Count']15class HealthCheckCountCheck(QuotaCheck):16 key = "route53_health_check_count"17 description = "Route53 Health Checks per Account"18 scope = QuotaScope.ACCOUNT19 @property20 def maximum(self):21 return self.boto_session.client('route53').get_account_limit(Type='MAX_HEALTH_CHECKS_BY_OWNER')['Limit']['Value']22 @property23 def current(self):24 return self.boto_session.client('route53').get_account_limit(Type='MAX_HEALTH_CHECKS_BY_OWNER')['Count']25class ReusableDelegationSetCountCheck(QuotaCheck):26 key = "route53_reusable_delegation_set_count"27 description = "Route53 Reusable Delegation Sets per Account"28 scope = QuotaScope.ACCOUNT29 @property30 def maximum(self):31 return self.boto_session.client('route53').get_account_limit(Type='MAX_REUSABLE_DELEGATION_SETS_BY_OWNER')['Limit']['Value']32 @property33 def current(self):34 return self.boto_session.client('route53').get_account_limit(Type='MAX_REUSABLE_DELEGATION_SETS_BY_OWNER')['Count']35class TrafficPolicyCountCheck(QuotaCheck):36 key = "route53_traffic_policy_count"37 description = "Route53 Traffic Policies per Account"38 scope = QuotaScope.ACCOUNT39 @property40 def maximum(self):41 return self.boto_session.client('route53').get_account_limit(Type='MAX_TRAFFIC_POLICIES_BY_OWNER')['Limit']['Value']42 @property43 def current(self):44 return self.boto_session.client('route53').get_account_limit(Type='MAX_TRAFFIC_POLICIES_BY_OWNER')['Count']45class TrafficPolicyInstanceCountCheck(QuotaCheck):46 key = "route53_traffic_policy_instance_count"47 description = "Route53 Traffic Policy Instances per Account"48 scope = QuotaScope.ACCOUNT49 @property50 def maximum(self):51 return self.boto_session.client('route53').get_account_limit(Type='MAX_TRAFFIC_POLICY_INSTANCES_BY_OWNER')['Limit']['Value']52 @property53 def current(self):54 return self.boto_session.client('route53').get_account_limit(Type='MAX_TRAFFIC_POLICY_INSTANCES_BY_OWNER')['Count']55class RecordsPerHostedZoneCheck(InstanceQuotaCheck):56 key = "route53_records_per_hosted_zone"57 description = "Records per Route53 Hosted Zone"58 instance_id = 'Hosted Zone ID'59 @staticmethod60 def get_all_identifiers(session: boto3.Session) -> typing.List[str]:61 return [zone['Id'] for zone in session.client('route53').list_hosted_zones()['HostedZones']]62 @property63 def maximum(self):64 try:65 return self.boto_session.client('route53').get_hosted_zone_limit(Type='MAX_RRSETS_BY_ZONE', HostedZoneId=self.instance_id)['Limit']['Value']66 except self.boto_session.client('route53').exceptions.NoSuchHostedZone as e:67 raise InstanceWithIdentifierNotFound(self) from e68 @property...
test_account_limits.py
Source: test_account_limits.py
...29 cls.rse2_id = get_rse(cls.rse2).id30 def test_set_account_limit(self):31 """ ACCOUNT_LIMIT (CORE): Setting account limit """32 account_limit.set_account_limit(account=self.account, rse_id=self.rse1_id, bytes=100000)33 assert_equal(account_limit.get_account_limit(account=self.account, rse_id=self.rse1_id), 100000)34 assert_equal(account_limit.get_account_limit(account=self.account, rse_id=self.rse2_id), float("Inf"))35class TestAccountClient():36 @classmethod37 def setUpClass(cls):38 # Add test account39 cls.account = ''.join(random.choice(string.ascii_uppercase) for x in range(10))40 add_account(account=cls.account, type=AccountType.USER)41 # Add test RSE42 cls.rse1 = 'MOCK'43 cls.rse2 = 'MOCK2'44 cls.rse1_id = get_rse(cls.rse1).id45 cls.rse2_id = get_rse(cls.rse2).id46 def setup(self):47 self.client = AccountClient()48 self.alclient = AccountLimitClient()49 def test_listing_account_limits(self):50 """ ACCOUNT (CLIENTS): Test listing account limits """51 account_limit.set_account_limit(account=self.account, rse_id=self.rse1_id, bytes=12345)52 account_limit.set_account_limit(account=self.account, rse_id=self.rse2_id, bytes=12345)53 limits = self.client.get_account_limits(account=self.account)54 assert_in((self.rse1, 12345), limits.items())55 assert_in((self.rse2, 12345), limits.items())56 account_limit.delete_account_limit(account=self.account, rse_id=self.rse1_id)57 account_limit.delete_account_limit(account=self.account, rse_id=self.rse2_id)58 def test_listing_account_limit(self):59 """ ACCOUNT (CLIENTS): Test listing account limit """60 account_limit.delete_account_limit(account=self.account, rse_id=self.rse1_id)61 account_limit.set_account_limit(account=self.account, rse_id=self.rse1_id, bytes=333)62 limit = self.client.get_account_limit(account=self.account, rse=self.rse1)63 assert_equal(limit, {self.rse1: 333})64 account_limit.delete_account_limit(account=self.account, rse_id=self.rse1_id)65 def test_setting_account_limit(self):66 """ ACCOUNTLIMIT (CLIENTS): Test setting account limit """67 self.alclient.set_account_limit(account=self.account, rse=self.rse1, bytes=987)68 limit = self.client.get_account_limit(account=self.account, rse=self.rse1)69 assert_equal(limit[self.rse1], 987)70 account_limit.delete_account_limit(account=self.account, rse_id=self.rse1_id)71 def test_deleting_account_limit(self):72 """ ACCOUNTLIMIT (CLIENTS): Test deleting account limit """73 self.alclient.set_account_limit(account=self.account, rse=self.rse1, bytes=786)74 limit = self.client.get_account_limit(account=self.account, rse=self.rse1)75 assert_equal(limit, {self.rse1: 786})76 self.alclient.delete_account_limit(account=self.account, rse=self.rse1)77 limit = self.client.get_account_limit(account=self.account, rse=self.rse1)78 assert_equal(limit[self.rse1], float('Inf'))...
Check out the latest blogs from LambdaTest on this topic:
“Test frequently and early.” If you’ve been following my testing agenda, you’re probably sick of hearing me repeat that. However, it is making sense that if your tests detect an issue soon after it occurs, it will be easier to resolve. This is one of the guiding concepts that makes continuous integration such an effective method. I’ve encountered several teams who have a lot of automated tests but don’t use them as part of a continuous integration approach. There are frequently various reasons why the team believes these tests cannot be used with continuous integration. Perhaps the tests take too long to run, or they are not dependable enough to provide correct results on their own, necessitating human interpretation.
When I started writing tests with Cypress, I was always going to use the user interface to interact and change the application’s state when running tests.
Ever since the Internet was invented, web developers have searched for the most efficient ways to display content on web browsers.
Estimates are critical if you want to be successful with projects. If you begin with a bad estimating approach, the project will almost certainly fail. To produce a much more promising estimate, direct each estimation-process issue toward a repeatable standard process. A smart approach reduces the degree of uncertainty. When dealing with presales phases, having the most precise estimation findings can assist you to deal with the project plan. This also helps the process to function more successfully, especially when faced with tight schedules and the danger of deviation.
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!!