How to use add_flavor_access method in tempest

Best Python code snippet using tempest_python

test_flavors_access_negative.py

Source:test_flavors_access_negative.py Github

copy

Full Screen

...82 id=new_flavor_id,83 is_public='False')['flavor']84 self.addCleanup(self.client.delete_flavor, new_flavor['id'])85 # Add flavor access to a tenant.86 self.client.add_flavor_access(new_flavor['id'], self.tenant_id)87 self.addCleanup(self.client.remove_flavor_access,88 new_flavor['id'], self.tenant_id)89 self.assertRaises(lib_exc.Forbidden,90 self.flavors_client.remove_flavor_access,91 new_flavor['id'],92 self.tenant_id)93 @test.attr(type=['negative'])94 @test.idempotent_id('f3592cc0-0306-483c-b210-9a7b5346eddc')95 def test_add_flavor_access_duplicate(self):96 # Create a new flavor.97 flavor_name = data_utils.rand_name(self.flavor_name_prefix)98 new_flavor_id = data_utils.rand_int_id(start=1000)99 new_flavor = self.client.create_flavor(name=flavor_name,100 ram=self.ram, vcpus=self.vcpus,101 disk=self.disk,102 id=new_flavor_id,103 is_public='False')['flavor']104 self.addCleanup(self.client.delete_flavor, new_flavor['id'])105 # Add flavor access to a tenant.106 self.client.add_flavor_access(new_flavor['id'], self.tenant_id)107 self.addCleanup(self.client.remove_flavor_access,108 new_flavor['id'], self.tenant_id)109 # An exception should be raised when adding flavor access to the same110 # tenant111 self.assertRaises(lib_exc.Conflict,112 self.client.add_flavor_access,113 new_flavor['id'],114 self.tenant_id)115 @test.attr(type=['negative'])116 @test.idempotent_id('1f710927-3bc7-4381-9f82-0ca6e42644b7')117 def test_remove_flavor_access_not_found(self):118 # Create a new flavor.119 flavor_name = data_utils.rand_name(self.flavor_name_prefix)120 new_flavor_id = data_utils.rand_int_id(start=1000)...

Full Screen

Full Screen

test_flavor_access_rbac.py

Source:test_flavor_access_rbac.py Github

copy

Full Screen

...63 @decorators.idempotent_id('39cb5c8f-9990-436f-9282-fc76a41d9bac')64 @rbac_rule_validation.action(65 service="nova",66 rules=["os_compute_api:os-flavor-access:add_tenant_access"])67 def test_add_flavor_access(self):68 with self.override_role():69 self.flavors_client.add_flavor_access(70 flavor_id=self.flavor_id, tenant_id=self.tenant_id)71 self.addCleanup(self.flavors_client.remove_flavor_access,72 flavor_id=self.flavor_id, tenant_id=self.tenant_id)73 @decorators.idempotent_id('61b8621f-52e4-473a-8d07-e228af8853d1')74 @rbac_rule_validation.action(75 service="nova",76 rules=["os_compute_api:os-flavor-access:remove_tenant_access"])77 def test_remove_flavor_access(self):78 self.flavors_client.add_flavor_access(79 flavor_id=self.flavor_id, tenant_id=self.tenant_id)80 self.addCleanup(test_utils.call_and_ignore_notfound_exc,81 self.flavors_client.remove_flavor_access,82 flavor_id=self.flavor_id, tenant_id=self.tenant_id)83 with self.override_role():84 self.flavors_client.remove_flavor_access(85 flavor_id=self.flavor_id, tenant_id=self.tenant_id)86 @decorators.idempotent_id('e1cf59fb-7f32-40a1-96b9-248ab23dd581')87 @rbac_rule_validation.action(88 service="nova",89 rules=["os_compute_api:os-flavor-access"])90 def test_list_flavor_access(self):91 # Add flavor access for os_primary so that it can access the flavor or92 # else a NotFound is raised.93 self.flavors_client.add_flavor_access(94 flavor_id=self.flavor_id, tenant_id=self.tenant_id)95 self.addCleanup(self.flavors_client.remove_flavor_access,96 flavor_id=self.flavor_id, tenant_id=self.tenant_id)97 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