How to use delete_region method in tempest

Best Python code snippet using tempest_python

test_region.py

Source:test_region.py Github

copy

Full Screen

...57 * whether the persona can update a region that does not exist58 """59 pass60 @abc.abstractmethod61 def test_identity_delete_region(self):62 """Test identity:delete_region policy.63 This test must check64 * whether the persona can delete a region65 * whether the persona can delete a region that does not exist66 """67 pass68class SystemAdminTests(IdentityV3RbacRegionTests, base.BaseIdentityTest):69 credentials = ['system_admin']70 def test_identity_create_region(self):71 region_id = self.do_request(72 'create_region', expected_status=201,73 **self.region())['region']['id']74 self.addCleanup(75 self.admin_regions_client.delete_region,76 region_id=region_id)77 def test_identity_get_region(self):78 region_id = self.admin_regions_client.create_region(79 **self.region())['region']['id']80 self.addCleanup(81 self.admin_regions_client.delete_region,82 region_id=region_id)83 self.do_request('show_region', region_id=region_id)84 # user gets a 404 for nonexistent region85 self.do_request('show_region', expected_status=exceptions.NotFound,86 region_id=data_utils.rand_uuid_hex())87 def test_identity_list_regions(self):88 region_id = self.admin_regions_client.create_region(89 **self.region())['region']['id']90 self.addCleanup(91 self.admin_regions_client.delete_region,92 region_id=region_id)93 resp = self.do_request('list_regions')94 self.assertIn(region_id, [e['id'] for e in resp['regions']])95 def test_identity_update_region(self):96 region_id = self.admin_regions_client.create_region(97 **self.region())['region']['id']98 self.addCleanup(99 self.admin_regions_client.delete_region,100 region_id=region_id)101 self.do_request('update_region',102 region_id=region_id,103 description=data_utils.rand_uuid_hex())104 # user gets a 404 for nonexistent region105 self.do_request('update_region', expected_status=exceptions.NotFound,106 region_id=data_utils.rand_uuid_hex(),107 description=data_utils.rand_uuid_hex())108 def test_identity_delete_region(self):109 region_id = self.admin_regions_client.create_region(110 **self.region())['region']['id']111 self.do_request('delete_region', expected_status=204,112 region_id=region_id)113 # user gets a 404 for nonexistent region114 self.do_request('delete_region', expected_status=exceptions.NotFound,115 region_id=data_utils.rand_uuid_hex())116class SystemMemberTests(SystemAdminTests, base.BaseIdentityTest):117 credentials = ['system_member', 'system_admin']118 def test_identity_create_region(self):119 self.do_request(120 'create_region', expected_status=exceptions.Forbidden,121 **self.region())122 def test_identity_update_region(self):123 region_id = self.admin_regions_client.create_region(124 **self.region())['region']['id']125 self.addCleanup(126 self.admin_regions_client.delete_region,127 region_id=region_id)128 self.do_request('update_region', expected_status=exceptions.Forbidden,129 region_id=region_id,130 description=data_utils.rand_uuid_hex())131 # user gets a 403 for nonexistent region132 self.do_request('update_region', expected_status=exceptions.Forbidden,133 region_id=data_utils.rand_uuid_hex(),134 description=data_utils.rand_uuid_hex())135 def test_identity_delete_region(self):136 region_id = self.admin_regions_client.create_region(137 **self.region())['region']['id']138 self.do_request('delete_region',139 expected_status=exceptions.Forbidden,140 region_id=region_id)141 # user gets a 403 for nonexistent region142 self.do_request('delete_region', expected_status=exceptions.Forbidden,143 region_id=data_utils.rand_uuid_hex())144class SystemReaderTests(SystemMemberTests):145 credentials = ['system_reader', 'system_admin']146class DomainAdminTests(SystemReaderTests, base.BaseIdentityTest):147 credentials = ['domain_admin', 'system_admin']148class DomainMemberTests(DomainAdminTests, base.BaseIdentityTest):149 credentials = ['domain_member', 'system_admin']...

Full Screen

Full Screen

pyrosetta_wrapper.py

Source:pyrosetta_wrapper.py Github

copy

Full Screen

...29 n_residues = pose.size()30 31 # if target residue is first32 if residue_id == 1:33 delete_region(ligand, 2, n_residues)34 # if target residue is last35 elif residue_id == n_residues:36 delete_region(ligand, 1, n_residues - 1)37 # if target residue is in the middle38 else:39 delete_region(ligand, residue_id + 1, n_residues)40 delete_region(ligand, 1, residue_id - 1)41 return ligand42def DeleteResidueFromPose(pose, residue_id):43 """Deletes target residue from pose """44 cleaned_pose = pose.clone()45 delete_region(cleaned_pose, residue_id, residue_id)46 return cleaned_pose47def GetPDBStringFromPose(pose):48 """Prepares PDB string"""49 50 buffer = pyrosetta.rosetta.std.stringbuf()51 pose.dump_pdb(pyrosetta.rosetta.std.ostream(buffer))52 53 return buffer.str()54def GetResidueIndex(pose, name="LG1"):55 """Searches target residue by name"""56 for i in range(1, pose.size()+1):57 if pose.residue(i).name() == name:58 return i59def LoadPDBFile(pdbfile):...

Full Screen

Full Screen

14.2.py

Source:14.2.py Github

copy

Full Screen

...12 for i in range(0, length):13 a = (position + i) % LIST_SIZE14 number_list[a] = shadow_list[a]15 return number_list16def delete_region(grid, i, j):17 grid[i][j] = 018 if i > 0 and grid[i - 1][j] == 1:19 delete_region(grid, i - 1, j)20 if i < GRID_SIZE - 1 and grid[i + 1][j] == 1:21 delete_region(grid, i + 1, j)22 if j > 0 and grid[i][j - 1] == 1:23 delete_region(grid, i, j - 1)24 if j < GRID_SIZE - 1 and grid[i][j + 1] == 1:25 delete_region(grid, i, j + 1)26grid = [[0 for i in range(GRID_SIZE)] for j in range(GRID_SIZE)]27for suffix in range(GRID_SIZE):28 number_list = [0] * LIST_SIZE29 position = 030 skip = 031 addition = ""32 row = LENGTHS + str(suffix)33 for i in range(LIST_SIZE):34 number_list[i] = i35 for char in ADDITIONAL_LENGTHS.split(','):36 addition += chr(int(char))37 for length in (row + addition) * 64:38 number_list = reverse(number_list, position, ord(length))39 position += ord(length) + skip40 if position >= LIST_SIZE:41 position -= LIST_SIZE42 skip += 143 row += ADDITIONAL_LENGTHS44 dense = [0] * 1645 knot_hash = ""46 for i in range(16):47 for j in range(16 * i, 16 * (i + 1)):48 dense[i] ^= number_list[j]49 knot_hash += '{0:b}'.format(dense[i]).zfill(8)50 for i in range(GRID_SIZE):51 grid[suffix][i] = int(knot_hash[i])52regions = 053for i in range(GRID_SIZE):54 for j in range(GRID_SIZE):55 if grid[i][j] == 1:56 regions += 157 delete_region(grid, i, j)...

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run tempest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful