How to use update_volume_type_extra_specs method in tempest

Best Python code snippet using tempest_python

test_volume_types_extra_specs_negative.py

Source:test_volume_types_extra_specs_negative.py Github

copy

Full Screen

1# Copyright 2012 OpenStack Foundation2# All Rights Reserved.3#4# Licensed under the Apache License, Version 2.0 (the "License"); you may5# not use this file except in compliance with the License. You may obtain6# a copy of the License at7#8# http://www.apache.org/licenses/LICENSE-2.09#10# Unless required by applicable law or agreed to in writing, software11# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT12# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the13# License for the specific language governing permissions and limitations14# under the License.15import uuid16from tempest_lib import exceptions as lib_exc17from tempest.api.volume import base18from tempest.common.utils import data_utils19from tempest import test20class ExtraSpecsNegativeV2Test(base.BaseVolumeAdminTest):21 @classmethod22 def resource_setup(cls):23 super(ExtraSpecsNegativeV2Test, cls).resource_setup()24 vol_type_name = data_utils.rand_name('Volume-type')25 cls.extra_specs = {"spec1": "val1"}26 cls.volume_type = cls.volume_types_client.create_volume_type(27 name=vol_type_name,28 extra_specs=cls.extra_specs)['volume_type']29 @classmethod30 def resource_cleanup(cls):31 cls.volume_types_client.delete_volume_type(cls.volume_type['id'])32 super(ExtraSpecsNegativeV2Test, cls).resource_cleanup()33 @test.idempotent_id('08961d20-5cbb-4910-ac0f-89ad6dbb2da1')34 def test_update_no_body(self):35 # Should not update volume type extra specs with no body36 extra_spec = {"spec1": "val2"}37 self.assertRaises(38 lib_exc.BadRequest,39 self.volume_types_client.update_volume_type_extra_specs,40 self.volume_type['id'], extra_spec.keys()[0], None)41 @test.idempotent_id('25e5a0ee-89b3-4c53-8310-236f76c75365')42 def test_update_nonexistent_extra_spec_id(self):43 # Should not update volume type extra specs with nonexistent id.44 extra_spec = {"spec1": "val2"}45 self.assertRaises(46 lib_exc.BadRequest,47 self.volume_types_client.update_volume_type_extra_specs,48 self.volume_type['id'], str(uuid.uuid4()),49 extra_spec)50 @test.idempotent_id('9bf7a657-b011-4aec-866d-81c496fbe5c8')51 def test_update_none_extra_spec_id(self):52 # Should not update volume type extra specs with none id.53 extra_spec = {"spec1": "val2"}54 self.assertRaises(55 lib_exc.BadRequest,56 self.volume_types_client.update_volume_type_extra_specs,57 self.volume_type['id'], None, extra_spec)58 @test.idempotent_id('a77dfda2-9100-448e-9076-ed1711f4bdfc')59 def test_update_multiple_extra_spec(self):60 # Should not update volume type extra specs with multiple specs as61 # body.62 extra_spec = {"spec1": "val2", "spec2": "val1"}63 self.assertRaises(64 lib_exc.BadRequest,65 self.volume_types_client.update_volume_type_extra_specs,66 self.volume_type['id'], extra_spec.keys()[0],67 extra_spec)68 @test.idempotent_id('49d5472c-a53d-4eab-a4d3-450c4db1c545')69 def test_create_nonexistent_type_id(self):70 # Should not create volume type extra spec for nonexistent volume71 # type id.72 extra_specs = {"spec2": "val1"}73 self.assertRaises(74 lib_exc.NotFound,75 self.volume_types_client.create_volume_type_extra_specs,76 str(uuid.uuid4()), extra_specs)77 @test.idempotent_id('c821bdc8-43a4-4bf4-86c8-82f3858d5f7d')78 def test_create_none_body(self):79 # Should not create volume type extra spec for none POST body.80 self.assertRaises(81 lib_exc.BadRequest,82 self.volume_types_client.create_volume_type_extra_specs,83 self.volume_type['id'], None)84 @test.idempotent_id('bc772c71-1ed4-4716-b945-8b5ed0f15e87')85 def test_create_invalid_body(self):86 # Should not create volume type extra spec for invalid POST body.87 self.assertRaises(88 lib_exc.BadRequest,89 self.volume_types_client.create_volume_type_extra_specs,90 self.volume_type['id'], extra_specs=['invalid'])91 @test.idempotent_id('031cda8b-7d23-4246-8bf6-bbe73fd67074')92 def test_delete_nonexistent_volume_type_id(self):93 # Should not delete volume type extra spec for nonexistent94 # type id.95 extra_specs = {"spec1": "val1"}96 self.assertRaises(97 lib_exc.NotFound,98 self.volume_types_client.delete_volume_type_extra_specs,99 str(uuid.uuid4()), extra_specs.keys()[0])100 @test.idempotent_id('dee5cf0c-cdd6-4353-b70c-e847050d71fb')101 def test_list_nonexistent_volume_type_id(self):102 # Should not list volume type extra spec for nonexistent type id.103 self.assertRaises(104 lib_exc.NotFound,105 self.volume_types_client.list_volume_types_extra_specs,106 str(uuid.uuid4()))107 @test.idempotent_id('9f402cbd-1838-4eb4-9554-126a6b1908c9')108 def test_get_nonexistent_volume_type_id(self):109 # Should not get volume type extra spec for nonexistent type id.110 extra_specs = {"spec1": "val1"}111 self.assertRaises(112 lib_exc.NotFound,113 self.volume_types_client.show_volume_type_extra_specs,114 str(uuid.uuid4()), extra_specs.keys()[0])115 @test.idempotent_id('c881797d-12ff-4f1a-b09d-9f6212159753')116 def test_get_nonexistent_extra_spec_id(self):117 # Should not get volume type extra spec for nonexistent extra spec118 # id.119 self.assertRaises(120 lib_exc.NotFound,121 self.volume_types_client.show_volume_type_extra_specs,122 self.volume_type['id'], str(uuid.uuid4()))123class ExtraSpecsNegativeV1Test(ExtraSpecsNegativeV2Test):...

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