How to use delete_role method in tempest

Best Python code snippet using tempest_python

registration.py

Source:registration.py Github

copy

Full Screen

...382 turkey = discord.utils.get(server.roles, name="Turkey")383 uk = discord.utils.get(server.roles, name="United Kingdom")384 await self.bot.reply("Ok, This will just take a moment")385 if male in server.roles:386 await self.bot.delete_role(server, name="Male")387 if female in server.roles:388 await self.bot.delete_role(server, name="Female")389 if trans in server.roles:390 await self.bot.delete_role(server, name="Transgender")391 if str8 in server.roles:392 await self.bot.delete_role(server, name="Straight")393 if gay in server.roles:394 await self.bot.delete_role(server, name="Gay")395 if bi in server.roles:396 await self.bot.delete_role(server, name="Bisexual")397 if pan in server.roles:398 await self.bot.delete_role(server, name="Pansexual")399 if dom in server.roles:400 await self.bot.delete_role(server, name="Dominant")401 if sub in server.roles:402 await self.bot.delete_role(server, name="Submissive")403 if switch in server.roles:404 await self.bot.delete_role(server, name="Switch")405 if over in server.roles:406 await self.bot.delete_role(server, name="Over 18")407 if reg in server.roles:408 await self.bot.delete_role(server, name="Registered")409 if under in server.roles:410 await self.bot.delete_role(server, name="Under 18")411 if mtf in server.roles:412 await self.bot.delete_role(server, name="Trans MTF")413 if ftm in server.roles:414 await self.bot.delete_role(server, name="Trans FTM")415 if asexual in server.roles:416 await self.bot.delete_role(server, name="Asexual")417 if usa1 in server.roles:418 await self.bot.delete_role(server, name="USA-Eastern")419 if usa2 in server.roles:420 await self.bot.delete_role(server, name="USA-Central")421 if usa3 in server.roles:422 await self.bot.delete_role(server, name="USA-Pacific")423 if usa4 in server.roles:424 await self.bot.delete_role(server, name="USA-Mountain")425 if africa in server.roles:426 await self.bot.delete_role(server, name="Africa")427 if asia in server.roles:428 await self.bot.delete_role(server, name="Asia")429 if australia in server.roles:430 await self.bot.delete_role(server, name="Australia")431 if austria in server.roles:432 await self.bot.delete_role(server, name="Austria")433 if belgium in server.roles:434 await self.bot.delete_role(server, name="Belgium")435 if bosnia in server.roles:436 await self.bot.delete_role(server, name="Bosnia")437 if brazil in server.roles:438 await self.bot.delete_role(server, name="Brazil")439 if bulgaria in server.roles:440 await self.bot.delete_role(server, name="Bulgaria")441 if canada in server.roles:442 await self.bot.delete_role(server, name="Canada")443 if croatia in server.roles:444 await self.bot.delete_role(server, name="Croatia")445 if czech in server.roles:446 await self.bot.delete_role(server, name="Czech")447 if denmark in server.roles:448 await self.bot.delete_role(server, name="Denmark")449 if estonia in server.roles:450 await self.bot.delete_role(server, name="Estonia")451 if europe in server.roles:452 await self.bot.delete_role(server, name="Europe")453 if finland in server.roles:454 await self.bot.delete_role(server, name="Finland")455 if france in server.roles:456 await self.bot.delete_role(server, name="France")457 if germany in server.roles:458 await self.bot.delete_role(server, name="Germany")459 if hungary in server.roles:460 await self.bot.delete_role(server, name="Hungary")461 if ireland in server.roles:462 await self.bot.delete_role(server, name="Ireland")463 if israel in server.roles:464 await self.bot.delete_role(server, name="Israel")465 if italy in server.roles:466 await self.bot.delete_role(server, name="Italy")467 if latvia in server.roles:468 await self.bot.delete_role(server, name="Latvia")469 if lithuania in server.roles:470 await self.bot.delete_role(server, name="Lithuania")471 if macedonia in server.roles:472 await self.bot.delete_role(server, name="Macedonia")473 if mexico in server.roles:474 await self.bot.delete_role(server, name="Mexico")475 if middleeast in server.roles:476 await self.bot.delete_role(server, name="Middle East")477 if netherlands in server.roles:478 await self.bot.delete_role(server, name="Netherlands")479 if norway in server.roles:480 await self.bot.delete_role(server, name="Norway")481 if newzealand in server.roles:482 await self.bot.delete_role(server, name="New Zealand")483 if philippines in server.roles:484 await self.bot.delete_role(server, name="Philippines")485 if poland in server.roles:486 await self.bot.delete_role(server, name="Poland")487 if portugal in server.roles:488 await self.bot.delete_role(server, name="Portugal")489 await asyncio.sleep(2.0)490 if romania in server.roles:491 await self.bot.delete_role(server, name="Romania")492 if russia in server.roles:493 await self.bot.delete_role(server, name="Russia")494 if saudi in server.roles:495 await self.bot.delete_role(server, name="Saudi")496 if scotland in server.roles:497 await self.bot.delete_role(server, name="Scotland")498 if serbia in server.roles:499 await self.bot.delete_role(server, name="Serbia")500 if singapore in server.roles:501 await self.bot.delete_role(server, name="Singapore")502 if slovakia in server.roles:503 await self.bot.delete_role(server, name="Slovakia")504 if slovenia in server.roles:505 await self.bot.delete_role(server, name="Slovenia")506 if southamerica in server.roles:507 await self.bot.delete_role(server, name="South America")508 if spain in server.roles:509 await self.bot.delete_role(server, name="Spain")510 if sweden in server.roles:511 await self.bot.delete_role(server, name="Sweden")512 if switzerland in server.roles:513 await self.bot.delete_role(server, name="Switzerland")514 if turkey in server.roles:515 await self.bot.delete_role(server, name="Turkey")516 if uk in server.roles:517 await self.bot.delete_role(server, name="United Kingdom")518 await asyncio.sleep(1.0)519 await self.bot.reply("All done!")520 else:521 await self.bot.reply("The command has timed out or you have entered an invalid response. "522 "Please only type yes or no. Try again later")523 except discord.HTTPException or discord.Forbidden:524 await self.bot.reply("Removal of roles has failed, The most common problem is that i do not Manage Roles "525 "Permissions on the server. Please check this and try again. or check your console! "526 "for full error details ")527 @commands.command(name="register", pass_context=True)528 async def registration(self, ctx):529 """"make a Introduction by following the prompts"""530 author = ctx.message.author531 server = ctx.message.server...

Full Screen

Full Screen

test_role.py

Source:test_role.py Github

copy

Full Screen

...75 * whether the persona can update a role that does not exist76 """77 pass78 @abc.abstractmethod79 def test_identity_delete_role(self):80 """Test identity:delete_role policy.81 This test must check82 * whether the persona can delete a role83 * whether the persona can delete a role that does not exist84 """85 pass86 @abc.abstractmethod87 def test_identity_create_domain_role(self):88 """Test identity:create_domain_role policy.89 This test must check:90 * whether the persona can create a domain role in their own domain91 * whether the persona can create a domain role in another domain92 """93 pass94 @abc.abstractmethod95 def test_identity_get_domain_role(self):96 """Test identity:get_domain_role policy.97 This test must check:98 * whether the persona can get a domain role in their own domain99 * whether the persona can get a domain role in another domain100 * whether the persona can get a domain role that does not exist101 """102 pass103 @abc.abstractmethod104 def test_identity_list_domain_roles(self):105 """Test identity:list_domain_roles policy.106 This test must check:107 * whether the persona can list domain roles for their own domain108 * whether the persona can list domain roles for another domain109 """110 pass111 @abc.abstractmethod112 def test_identity_update_domain_role(self):113 """Test identity:update_domain_role policy.114 This test must check:115 * whether the persona can update a domain role for their own domain116 * whether the persona can update a domain role for another domain117 * whether the persona can update a domain role that does not exist118 """119 pass120 @abc.abstractmethod121 def test_identity_delete_domain_role(self):122 """Test identity:delete_domain_role policy.123 This test must check124 * whether the persona can delete a domain role for their own domain125 * whether the persona can delete a domain role for another domain126 * whether the persona can delete a domain role that does not exist127 """128 pass129class SystemAdminTests(IdentityV3RbacRoleTest, base.BaseIdentityTest):130 credentials = ['system_admin']131 def test_identity_create_role(self):132 # user can create role133 resp = self.do_request('create_role',134 expected_status=201,135 **self.role())136 self.addCleanup(self.admin_roles_client.delete_role,137 resp['role']['id'])138 def test_identity_get_role(self):139 # user can get role140 role = self.admin_roles_client.create_role(**self.role())['role']141 self.addCleanup(self.admin_roles_client.delete_role, role['id'])142 self.do_request('show_role', role_id=role['id'])143 # user gets a 404 for nonexistent role144 self.do_request('show_role', expected_status=exceptions.NotFound,145 role_id=data_utils.rand_uuid_hex())146 def test_identity_list_roles(self):147 # user can list roles148 role = self.admin_roles_client.create_role(**self.role())['role']149 self.addCleanup(self.admin_roles_client.delete_role, role['id'])150 self.do_request('list_roles')151 def test_identity_update_role(self):152 # user can update role153 role = self.admin_roles_client.create_role(**self.role())['role']154 self.addCleanup(self.admin_roles_client.delete_role, role['id'])155 self.do_request('update_role',156 role_id=role['id'],157 description=data_utils.arbitrary_string())158 # user gets a 404 for nonexistent role159 self.do_request('update_role', expected_status=exceptions.NotFound,160 role_id=data_utils.rand_uuid_hex(),161 description=data_utils.arbitrary_string())162 def test_identity_delete_role(self):163 # user can delete role164 role = self.admin_roles_client.create_role(**self.role())['role']165 self.do_request('delete_role', expected_status=204, role_id=role['id'])166 # user gets a 404 for nonexistent role167 self.do_request('delete_role', expected_status=exceptions.NotFound,168 role_id=data_utils.rand_uuid_hex())169 def test_identity_create_domain_role(self):170 # user can create domain role171 resp = self.do_request('create_role',172 expected_status=201,173 **self.role(domain_id=self.domain_id))174 self.addCleanup(self.admin_roles_client.delete_role,175 resp['role']['id'])176 def test_identity_get_domain_role(self):177 # user can get domain role178 role = self.admin_roles_client.create_role(179 **self.role(domain_id=self.domain_id))['role']180 self.addCleanup(self.admin_roles_client.delete_role, role['id'])181 self.do_request('show_role', role_id=role['id'])182 # user gets a 404 for nonexistent domain role183 self.do_request('show_role', expected_status=exceptions.NotFound,184 role_id=data_utils.rand_uuid_hex())185 def test_identity_list_domain_roles(self):186 # user can list domain roles187 role = self.admin_roles_client.create_role(188 **self.role(domain_id=self.domain_id))['role']189 self.addCleanup(self.admin_roles_client.delete_role, role['id'])190 self.do_request('list_roles', domain_id=self.domain_id)191 def test_identity_update_domain_role(self):192 # user can update domain role193 role = self.admin_roles_client.create_role(194 **self.role(domain_id=self.domain_id))['role']195 self.addCleanup(self.admin_roles_client.delete_role, role['id'])196 self.do_request('update_role',197 role_id=role['id'],198 description=data_utils.arbitrary_string())199 # user gets a 404 for nonexistent domain role200 self.do_request('update_role', expected_status=exceptions.NotFound,201 role_id=data_utils.rand_uuid_hex(),202 description=data_utils.arbitrary_string())203 def test_identity_delete_domain_role(self):204 # user can delete role in other domain205 role = self.admin_roles_client.create_role(206 **self.role(domain_id=self.domain_id))['role']207 self.do_request('delete_role', expected_status=204, role_id=role['id'])208 # user gets a 404 for nonexistent role209 self.do_request('delete_role', expected_status=exceptions.NotFound,210 role_id=data_utils.rand_uuid_hex())211class SystemMemberTests(SystemAdminTests):212 credentials = ['system_member', 'system_admin']213 def test_identity_create_role(self):214 # user cannot create role215 self.do_request('create_role',216 expected_status=exceptions.Forbidden,217 **self.role())218 def test_identity_update_role(self):219 # user cannot update role220 role = self.admin_roles_client.create_role(221 **self.role())['role']222 self.addCleanup(self.admin_roles_client.delete_role, role['id'])223 self.do_request('update_role', expected_status=exceptions.Forbidden,224 role_id=role['id'],225 description=data_utils.arbitrary_string())226 # user gets a 404 for nonexistent role227 self.do_request('update_role', expected_status=exceptions.NotFound,228 role_id=data_utils.rand_uuid_hex(),229 description=data_utils.arbitrary_string())230 def test_identity_delete_role(self):231 # user can delete role232 role = self.admin_roles_client.create_role(233 **self.role())['role']234 self.do_request('delete_role', expected_status=exceptions.Forbidden,235 role_id=role['id'])236 # user gets a 404 for nonexistent domain role237 self.do_request('delete_role', expected_status=exceptions.NotFound,238 role_id=data_utils.rand_uuid_hex())239 def test_identity_create_domain_role(self):240 # user cannot create domain role241 self.do_request('create_role',242 expected_status=exceptions.Forbidden,243 **self.role(domain_id=self.domain_id))244 def test_identity_update_domain_role(self):...

Full Screen

Full Screen

test_delete_role.py

Source:test_delete_role.py Github

copy

Full Screen

...12 self.mocked_requests_delete.return_value = Mock(status_code=200)13 self.mocked_check_role_exists = self.set_up_patch('searchguard.roles.check_role_exists')14 self.mocked_check_role_exists.return_value = True15 def test_delete_role_returns_when_successfully_deleted_role(self):16 self.assertIsNone(delete_role(self.role))17 def test_delete_role_returns_exception_when_user_does_not_exist(self):18 self.mocked_check_role_exists.return_value = False19 with self.assertRaises(DeleteRoleException):20 delete_role(self.role)21 def test_delete_role_returns_exception_when_requests_return_code_not_200(self):22 self.mocked_requests_delete.return_value = Mock(status_code=999)23 with self.assertRaises(DeleteRoleException):24 delete_role(self.role)25 def test_delete_role_calls_check_role_exist(self):26 delete_role(self.role)27 self.mocked_check_role_exists.assert_called_once_with(self.role)28 def test_delete_role_calls_requests_with_correct_arguments(self):29 delete_role(self.role)30 self.mocked_requests_delete.assert_called_once_with('{}{}'.format(self.api_url, self.role),...

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