How to use update_project_tag method in tempest

Best Python code snippet using tempest_python

test_project_tag.py

Source:test_project_tag.py Github

copy

Full Screen

...109 tag=data_utils.rand_uuid_hex()110 )111 def test_identity_get_project_tag(self):112 tag = data_utils.rand_uuid_hex()113 self.admin_project_tags_client.update_project_tag(114 project_id=self.project_id, tag=tag)115 self.do_request('check_project_tag_existence',116 expected_status=204,117 project_id=self.project_id, tag=tag)118 def test_identity_list_project_tags(self):119 tag = data_utils.rand_uuid_hex()120 self.admin_project_tags_client.update_project_tag(121 project_id=self.project_id, tag=tag)122 resp = self.do_request('list_project_tags', project_id=self.project_id)123 self.assertIn(tag, resp['tags'])124 def test_identity_update_project_tags(self):125 self.do_request('update_all_project_tags',126 project_id=self.project_id,127 tags=[data_utils.rand_uuid_hex()])128 def test_identity_delete_project_tag(self):129 tag = data_utils.rand_uuid_hex()130 self.admin_project_tags_client.update_project_tag(131 project_id=self.project_id, tag=tag)132 self.do_request('delete_project_tag', expected_status=204,133 project_id=self.project_id,134 tag=tag)135 def test_identity_delete_project_tags(self):136 tag = data_utils.rand_uuid_hex()137 self.admin_project_tags_client.update_project_tag(138 project_id=self.project_id, tag=tag)139 self.do_request('delete_all_project_tags', expected_status=204,140 project_id=self.project_id)141class SystemMemberTests(SystemAdminTests, base.BaseIdentityTest):142 credentials = ['system_member', 'system_admin']143 def test_identity_create_project_tag(self):144 self.do_request(145 'update_project_tag', expected_status=exceptions.Forbidden,146 project_id=self.project_id,147 tag=data_utils.rand_uuid_hex()148 )149 def test_identity_update_project_tags(self):150 self.do_request('update_all_project_tags',151 expected_status=exceptions.Forbidden,152 project_id=self.project_id,153 tags=[data_utils.rand_uuid_hex()])154 def test_identity_delete_project_tag(self):155 tag = data_utils.rand_uuid_hex()156 self.admin_project_tags_client.update_project_tag(157 project_id=self.project_id, tag=tag)158 self.do_request('delete_project_tag',159 expected_status=exceptions.Forbidden,160 project_id=self.project_id,161 tag=tag)162 def test_identity_delete_project_tags(self):163 tag = data_utils.rand_uuid_hex()164 self.admin_project_tags_client.update_project_tag(165 project_id=self.project_id, tag=tag)166 self.do_request('delete_all_project_tags',167 expected_status=exceptions.Forbidden,168 project_id=self.project_id)169class SystemReaderTests(SystemMemberTests):170 credentials = ['system_reader', 'system_admin']171class DomainAdminTests(IdentityV3RbacProjectTagTests, base.BaseIdentityTest):172 credentials = ['domain_admin', 'system_admin']173 def setUp(self):174 super(DomainAdminTests, self).setUp()175 self.own_domain = self.persona.credentials.domain_id176 self.other_domain = self.admin_client.domains_client.create_domain(177 name=data_utils.rand_name())['domain']['id']178 self.addCleanup(self.admin_client.domains_client.delete_domain,179 self.other_domain)180 self.addCleanup(self.admin_client.domains_client.update_domain,181 domain_id=self.other_domain, enabled=False)182 project_client = self.admin_client.projects_client183 self.own_project_id = project_client.create_project(184 name=data_utils.rand_name(),185 domain_id=self.own_domain)['project']['id']186 self.addCleanup(187 project_client.delete_project,188 self.own_project_id)189 self.other_project_id = project_client.create_project(190 name=data_utils.rand_name(),191 domain_id=self.other_domain)['project']['id']192 self.addCleanup(project_client.delete_project, self.other_project_id)193 def test_identity_create_project_tag(self):194 # user can add tags to project in own domain195 tag = data_utils.rand_uuid_hex()196 self.do_request(197 'update_project_tag', expected_status=201,198 project_id=self.own_project_id,199 tag=tag200 )201 # user cannot add tags to project in other domain202 tag = data_utils.rand_uuid_hex()203 self.do_request(204 'update_project_tag', expected_status=exceptions.Forbidden,205 project_id=self.other_project_id,206 tag=tag207 )208 def test_identity_get_project_tag(self):209 # user can get tag for project in own domain210 tag = data_utils.rand_uuid_hex()211 self.admin_project_tags_client.update_project_tag(212 project_id=self.own_project_id, tag=tag)213 self.do_request('check_project_tag_existence',214 expected_status=204,215 project_id=self.own_project_id, tag=tag)216 # user cannot get tag for project in other domain217 tag = data_utils.rand_uuid_hex()218 self.admin_project_tags_client.update_project_tag(219 project_id=self.other_project_id, tag=tag)220 self.do_request('check_project_tag_existence',221 expected_status=exceptions.Forbidden,222 project_id=self.other_project_id, tag=tag)223 def test_identity_list_project_tags(self):224 # user can list tags for project in own domain225 tag = data_utils.rand_uuid_hex()226 self.admin_project_tags_client.update_project_tag(227 project_id=self.own_project_id, tag=tag)228 resp = self.do_request('list_project_tags',229 project_id=self.own_project_id)230 self.assertIn(tag, resp['tags'])231 # user cannot list tags for project in other domain232 tag = data_utils.rand_uuid_hex()233 self.admin_project_tags_client.update_project_tag(234 project_id=self.other_project_id, tag=tag)235 self.do_request('list_project_tags',236 expected_status=exceptions.Forbidden,237 project_id=self.other_project_id)238 def test_identity_update_project_tags(self):239 # user can update tags for project in own domain240 tag = data_utils.rand_uuid_hex()241 self.do_request('update_all_project_tags',242 project_id=self.own_project_id,243 tags=[tag])244 # user cannot update tags for project in other domain245 tag = data_utils.rand_uuid_hex()246 self.do_request('update_all_project_tags',247 expected_status=exceptions.Forbidden,248 project_id=self.other_project_id,249 tags=[tag])250 def test_identity_delete_project_tag(self):251 # user can delete tag for project in own domain252 tag = data_utils.rand_uuid_hex()253 self.admin_project_tags_client.update_project_tag(254 project_id=self.own_project_id, tag=tag)255 self.do_request('delete_project_tag', expected_status=204,256 project_id=self.own_project_id,257 tag=tag)258 # user cannot delete tag for project in other domain259 tag = data_utils.rand_uuid_hex()260 self.admin_project_tags_client.update_project_tag(261 project_id=self.other_project_id, tag=tag)262 self.do_request('delete_project_tag',263 expected_status=exceptions.Forbidden,264 project_id=self.other_project_id,265 tag=tag)266 def test_identity_delete_project_tags(self):267 # user can delete tags for project in own domain268 tag = data_utils.rand_uuid_hex()269 self.admin_project_tags_client.update_project_tag(270 project_id=self.own_project_id, tag=tag)271 self.do_request('delete_all_project_tags', expected_status=204,272 project_id=self.own_project_id)273 # user cannot delete tags for project in other domain274 tag = data_utils.rand_uuid_hex()275 self.admin_project_tags_client.update_project_tag(276 project_id=self.other_project_id, tag=tag)277 self.do_request('delete_all_project_tags',278 expected_status=exceptions.Forbidden,279 project_id=self.other_project_id)280class DomainMemberTests(DomainAdminTests, base.BaseIdentityTest):281 credentials = ['domain_member', 'system_admin']282 def test_identity_create_project_tag(self):283 # user cannot add tags to project in own domain284 tag = data_utils.rand_uuid_hex()285 self.do_request(286 'update_project_tag', expected_status=exceptions.Forbidden,287 project_id=self.own_project_id,288 tag=tag289 )290 # user cannot add tags to project in other domain291 tag = data_utils.rand_uuid_hex()292 self.do_request(293 'update_project_tag', expected_status=exceptions.Forbidden,294 project_id=self.other_project_id,295 tag=tag296 )297 def test_identity_update_project_tags(self):298 # user cannot update tags for project in own domain299 tag = data_utils.rand_uuid_hex()300 self.do_request('update_all_project_tags',301 expected_status=exceptions.Forbidden,302 project_id=self.own_project_id,303 tags=[tag])304 # user cannot update tags for project in other domain305 tag = data_utils.rand_uuid_hex()306 self.do_request('update_all_project_tags',307 expected_status=exceptions.Forbidden,308 project_id=self.other_project_id,309 tags=[tag])310 def test_identity_delete_project_tag(self):311 # user cannot delete tag for project in own domain312 tag = data_utils.rand_uuid_hex()313 self.admin_project_tags_client.update_project_tag(314 project_id=self.own_project_id, tag=tag)315 self.do_request('delete_project_tag',316 expected_status=exceptions.Forbidden,317 project_id=self.own_project_id,318 tag=tag)319 # user cannot delete tag for project in other domain320 tag = data_utils.rand_uuid_hex()321 self.admin_project_tags_client.update_project_tag(322 project_id=self.other_project_id, tag=tag)323 self.do_request('delete_project_tag',324 expected_status=exceptions.Forbidden,325 project_id=self.other_project_id,326 tag=tag)327 def test_identity_delete_project_tags(self):328 # user cannot delete tags for project in own domain329 tag = data_utils.rand_uuid_hex()330 self.admin_project_tags_client.update_project_tag(331 project_id=self.own_project_id, tag=tag)332 self.do_request('delete_all_project_tags',333 expected_status=exceptions.Forbidden,334 project_id=self.own_project_id)335 # user cannot delete tags for project in other domain336 tag = data_utils.rand_uuid_hex()337 self.admin_project_tags_client.update_project_tag(338 project_id=self.other_project_id, tag=tag)339 self.do_request('delete_all_project_tags',340 expected_status=exceptions.Forbidden,341 project_id=self.other_project_id)342class DomainReaderTests(DomainMemberTests):343 credentials = ['domain_reader', 'system_admin']344class ProjectAdminTests(IdentityV3RbacProjectTagTests, base.BaseIdentityTest):345 credentials = ['project_admin', 'system_admin']346 def setUp(self):347 super(ProjectAdminTests, self).setUp()348 self.own_project_id = self.persona.credentials.project_id349 project_client = self.admin_client.projects_client350 self.other_project_id = project_client.create_project(351 name=data_utils.rand_name())['project']['id']352 self.addCleanup(project_client.delete_project, self.other_project_id)353 def test_identity_create_project_tag(self):354 # user can add tags to own project355 tag = data_utils.rand_uuid_hex()356 self.do_request(357 'update_project_tag', expected_status=201,358 project_id=self.own_project_id,359 tag=tag360 )361 self.addCleanup(self.admin_project_tags_client.delete_project_tag,362 project_id=self.own_project_id,363 tag=tag)364 # user cannot add tags to arbitrary project365 tag = data_utils.rand_uuid_hex()366 self.do_request(367 'update_project_tag', expected_status=exceptions.Forbidden,368 project_id=self.other_project_id,369 tag=tag370 )371 def test_identity_get_project_tag(self):372 # user can get tag for own project373 tag = data_utils.rand_uuid_hex()374 self.admin_project_tags_client.update_project_tag(375 project_id=self.own_project_id, tag=tag)376 self.addCleanup(self.admin_project_tags_client.delete_project_tag,377 project_id=self.own_project_id,378 tag=tag)379 self.do_request('check_project_tag_existence',380 expected_status=204,381 project_id=self.own_project_id, tag=tag)382 # user cannot get tag for arbitrary project383 tag = data_utils.rand_uuid_hex()384 self.admin_project_tags_client.update_project_tag(385 project_id=self.other_project_id, tag=tag)386 self.do_request('check_project_tag_existence',387 expected_status=exceptions.Forbidden,388 project_id=self.other_project_id, tag=tag)389 def test_identity_list_project_tags(self):390 # user can list tags for own project391 tag = data_utils.rand_uuid_hex()392 self.admin_project_tags_client.update_project_tag(393 project_id=self.own_project_id, tag=tag)394 self.addCleanup(self.admin_project_tags_client.delete_project_tag,395 project_id=self.own_project_id,396 tag=tag)397 resp = self.do_request('list_project_tags',398 project_id=self.own_project_id)399 self.assertIn(tag, resp['tags'])400 # user cannot list tags for arbitrary project401 tag = data_utils.rand_uuid_hex()402 self.admin_project_tags_client.update_project_tag(403 project_id=self.other_project_id, tag=tag)404 self.do_request('list_project_tags',405 expected_status=exceptions.Forbidden,406 project_id=self.other_project_id)407 def test_identity_update_project_tags(self):408 # user can update tags for own project409 tag = data_utils.rand_uuid_hex()410 self.do_request('update_all_project_tags',411 project_id=self.own_project_id,412 tags=[tag])413 self.addCleanup(self.admin_project_tags_client.delete_project_tag,414 project_id=self.own_project_id,415 tag=tag)416 # user cannot update tags for arbitrary project417 tag = data_utils.rand_uuid_hex()418 self.do_request('update_all_project_tags',419 expected_status=exceptions.Forbidden,420 project_id=self.other_project_id,421 tags=[tag])422 def test_identity_delete_project_tag(self):423 # user can delete tag for own project424 tag = data_utils.rand_uuid_hex()425 self.admin_project_tags_client.update_project_tag(426 project_id=self.own_project_id, tag=tag)427 self.do_request('delete_project_tag', expected_status=204,428 project_id=self.own_project_id,429 tag=tag)430 # user cannot delete tag for arbitrary project431 tag = data_utils.rand_uuid_hex()432 self.admin_project_tags_client.update_project_tag(433 project_id=self.other_project_id, tag=tag)434 self.do_request('delete_project_tag',435 expected_status=exceptions.Forbidden,436 project_id=self.other_project_id,437 tag=tag)438 def test_identity_delete_project_tags(self):439 # user can delete tags for own project440 tag = data_utils.rand_uuid_hex()441 self.admin_project_tags_client.update_project_tag(442 project_id=self.own_project_id, tag=tag)443 self.do_request('delete_all_project_tags', expected_status=204,444 project_id=self.own_project_id)445 # user cannot delete tags for arbitrary project446 tag = data_utils.rand_uuid_hex()447 self.admin_project_tags_client.update_project_tag(448 project_id=self.other_project_id, tag=tag)449 self.do_request('delete_all_project_tags',450 expected_status=exceptions.Forbidden,451 project_id=self.other_project_id)452class ProjectMemberTests(ProjectAdminTests):453 credentials = ['project_member', 'system_admin']454 def test_identity_create_project_tag(self):455 # user cannot add tags to own project456 tag = data_utils.rand_uuid_hex()457 self.do_request(458 'update_project_tag', expected_status=exceptions.Forbidden,459 project_id=self.own_project_id,460 tag=tag461 )462 # user cannot add tags to arbitrary project463 tag = data_utils.rand_uuid_hex()464 self.do_request(465 'update_project_tag', expected_status=exceptions.Forbidden,466 project_id=self.other_project_id,467 tag=tag468 )469 def test_identity_update_project_tags(self):470 # user cannot update tags for own project471 tag = data_utils.rand_uuid_hex()472 self.do_request('update_all_project_tags',473 expected_status=exceptions.Forbidden,474 project_id=self.own_project_id,475 tags=[tag])476 # user cannot update tags for arbitrary project477 tag = data_utils.rand_uuid_hex()478 self.do_request('update_all_project_tags',479 expected_status=exceptions.Forbidden,480 project_id=self.other_project_id,481 tags=[tag])482 def test_identity_delete_project_tag(self):483 # user cannot delete tag for own project484 tag = data_utils.rand_uuid_hex()485 self.admin_project_tags_client.update_project_tag(486 project_id=self.own_project_id, tag=tag)487 self.addCleanup(self.admin_project_tags_client.delete_project_tag,488 project_id=self.own_project_id,489 tag=tag)490 self.do_request('delete_project_tag',491 expected_status=exceptions.Forbidden,492 project_id=self.own_project_id,493 tag=tag)494 # user cannot delete tag for arbitrary project495 tag = data_utils.rand_uuid_hex()496 self.admin_project_tags_client.update_project_tag(497 project_id=self.other_project_id, tag=tag)498 self.do_request('delete_project_tag',499 expected_status=exceptions.Forbidden,500 project_id=self.other_project_id,501 tag=tag)502 def test_identity_delete_project_tags(self):503 # user cannot delete tags for own project504 tag = data_utils.rand_uuid_hex()505 self.admin_project_tags_client.update_project_tag(506 project_id=self.own_project_id, tag=tag)507 self.addCleanup(self.admin_project_tags_client.delete_project_tag,508 project_id=self.own_project_id,509 tag=tag)510 self.do_request('delete_all_project_tags',511 expected_status=exceptions.Forbidden,512 project_id=self.own_project_id)513 # user cannot delete tags for arbitrary project514 tag = data_utils.rand_uuid_hex()515 self.admin_project_tags_client.update_project_tag(516 project_id=self.other_project_id, tag=tag)517 self.do_request('delete_all_project_tags',518 expected_status=exceptions.Forbidden,519 project_id=self.other_project_id)520class ProjectReaderTests(ProjectMemberTests):...

Full Screen

Full Screen

test_project_tags_rbac.py

Source:test_project_tags_rbac.py Github

copy

Full Screen

...33 super(ProjectTagsV3RbacTest, self).tearDown()34 @decorators.idempotent_id('acbd7b2d-0a4d-4990-9fab-eccad69d4238')35 @rbac_rule_validation.action(service="keystone",36 rules=["identity:create_project_tag"])37 def test_update_project_tag(self):38 tag = data_utils.rand_name(self.__class__.__name__ + '-Tag')39 with self.override_role():40 self.project_tags_client.update_project_tag(self.project_id, tag)41 @decorators.idempotent_id('e122d7d1-bb6d-43af-b489-afa8c609b9ae')42 @rbac_rule_validation.action(service="keystone",43 rules=["identity:list_project_tags"])44 def test_list_project_tags(self):45 with self.override_role():46 self.project_tags_client.list_project_tags(self.project_id)47 @decorators.idempotent_id('716f9081-4626-4594-a82c-e7dc037464ac')48 @rbac_rule_validation.action(service="keystone",49 rules=["identity:update_project_tags"])50 def test_update_all_project_tags(self):51 tags = [52 data_utils.rand_name(self.__class__.__name__ + '-Tag')53 for _ in range(2)54 ]55 with self.override_role():56 self.project_tags_client.update_all_project_tags(57 self.project_id, tags)58 @decorators.idempotent_id('974cb1da-d7d4-4863-99da-4a3f0c801729')59 @rbac_rule_validation.action(service="keystone",60 rules=["identity:get_project_tag"])61 def test_check_project_tag_existence(self):62 tag = data_utils.rand_name(self.__class__.__name__ + '-Tag')63 self.project_tags_client.update_project_tag(self.project_id, tag)64 with self.override_role():65 self.project_tags_client.check_project_tag_existence(66 self.project_id, tag)67 @decorators.idempotent_id('ffe0c8e1-f9eb-43c5-8097-1e938fc08e07')68 @rbac_rule_validation.action(service="keystone",69 rules=["identity:delete_project_tag"])70 def test_delete_project_tag(self):71 tag = data_utils.rand_name(self.__class__.__name__ + '-Tag')72 self.project_tags_client.update_project_tag(self.project_id, tag)73 with self.override_role():74 self.project_tags_client.delete_project_tag(self.project_id, tag)75 @decorators.idempotent_id('94d0ef63-e9e3-4287-9c5e-bd5464467d77')76 @rbac_rule_validation.action(service="keystone",77 rules=["identity:delete_project_tags"])78 def test_delete_all_project_tags(self):79 with self.override_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