Best Python code snippet using tempest_python
tests.py
Source:tests.py
...173 gbp_ghs=5.3,174 gbp_usd=1.6,175 gbp_sll=7040176 )177 def _create_limit(self, transaction_min, transaction_max, user_limit_basic,178 user_limit_complete, site_id):179 site = Site.objects.get(id=site_id)180 limit = Limit(181 transaction_min=transaction_min,182 transaction_max=transaction_max,183 user_limit_basic=user_limit_basic,184 user_limit_complete=user_limit_complete,185 site=site186 )187 end_previous_object_by_site(Limit, site)188 limit.save()189 return limit190 def _create_default_limit_beam(self):191 return self._create_limit(192 transaction_min=2,193 transaction_max=1000,194 user_limit_basic=40,195 user_limit_complete=500,196 site_id=0197 )198 def _create_default_limit_bae(self):199 return self._create_limit(200 transaction_min=3,201 transaction_max=600,202 user_limit_basic=50,203 user_limit_complete=600,204 site_id=1205 )206 def _create_comparison(self):207 comparison = Comparison(price_comparison=self.default_comparison)208 end_previous_object(Comparison)209 comparison.save()210 return comparison211 def _create_state(self, state=None, site_id=None):212 if not state:213 state = State.RUNNING...
test_compute_unified_limits.py
Source:test_compute_unified_limits.py
...47 # update them in-place without needing to know which ones have been48 # created and in which order.49 cls.limit_ids = {}50 @classmethod51 def _create_limit(cls, name, value):52 return cls.os_system_admin.identity_limits_client.create_limit(53 CONF.identity.region, cls.nova_service_id,54 cls.servers_client.tenant_id, name, value)['limits'][0]['id']55 def _update_limit(self, name, value):56 self.os_system_admin.identity_limits_client.update_limit(57 self.limit_ids[name], value)58class ServersQuotaTest(ComputeProjectQuotaTest):59 @classmethod60 def resource_setup(cls):61 super(ServersQuotaTest, cls).resource_setup()62 try:63 cls.limit_ids['servers'] = cls._create_limit(64 'servers', 5)65 cls.limit_ids['class:VCPU'] = cls._create_limit(66 'class:VCPU', 10)67 cls.limit_ids['class:MEMORY_MB'] = cls._create_limit(68 'class:MEMORY_MB', 25 * 1024)69 cls.limit_ids['class:DISK_GB'] = cls._create_limit(70 'class:DISK_GB', 10)71 except lib_exc.Forbidden:72 raise cls.skipException('Target system is not configured with '73 'compute unified limits')74 @decorators.idempotent_id('555d8bbf-d2ed-4e39-858c-4235899402d9')75 @utils.services('compute')76 def test_server_count_vcpu_memory_disk_quota(self):77 # Set a quota on the number of servers for our tenant to one.78 self._update_limit('servers', 1)79 # Create one server.80 first = self.create_server(name='first')81 # Second server would put us over quota, so expect failure.82 # NOTE: In nova, quota exceeded raises 403 Forbidden.83 self.assertRaises(lib_exc.Forbidden,...
seed_suppliers.py
Source:seed_suppliers.py
...19 return super().add_arguments(parser)20 21 def handle(self, *args: Any, **options: Any) -> Optional[str]:22 num = self._validate_num(options['num'])23 self._create_limit(num)24 self.stdout.write(self.style.MIGRATE_HEADING(f'migrating {num} supplier'))25 self.stdout.write(self.style.SUCCESS('Data has migrated successfully')) 26 def _validate_num(self, num):27 if num > 1000 or num < 1:28 num = 100029 return num30 31 def _create_limit(self, num):32 names_file = json_names_to_dic()33 names = json_names_to_dic(num)34 for row in range(num):35 name = names[row]36 phone = generate_phone(name)37 data = {38 'name': name,39 'phone': phone40 }41 SUPPLIER.update(data)...
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!!