Fix test case for updating volume type extra specs
The create_volume_type_extra_specs API in volume types_client actually contains both 'create' and 'update' function for extra specs of a volume type. The 'update' function not only can update volume type's existing extra specs, but also can add new extra specs to the volume type. This patch adds test for this 'update' function. Change-Id: Iaa7c760920267c7db58650fc120e8c9033e875d7
This commit is contained in:
parent
c0a96b3132
commit
b74a207e64
|
@ -46,14 +46,32 @@ class VolumeTypesExtraSpecsTest(base.BaseVolumeAdminTest):
|
|||
self.volume_type['id'], extra_specs)['extra_specs']
|
||||
self.assertEqual(extra_specs, body,
|
||||
"Volume type extra spec incorrectly created")
|
||||
|
||||
# Only update an extra spec
|
||||
spec_key = "spec2"
|
||||
extra_spec = {spec_key: "val2"}
|
||||
body = self.admin_volume_types_client.update_volume_type_extra_specs(
|
||||
self.volume_type['id'], spec_key, extra_spec)
|
||||
self.assertIn(spec_key, body)
|
||||
self.assertEqual(extra_spec[spec_key], body[spec_key])
|
||||
body = self.admin_volume_types_client.show_volume_type_extra_specs(
|
||||
self.volume_type['id'], spec_key)
|
||||
self.assertIn(spec_key, body)
|
||||
self.assertEqual(extra_spec[spec_key], body[spec_key],
|
||||
"Volume type extra spec incorrectly updated")
|
||||
|
||||
# Update an existing extra spec and create a new extra spec
|
||||
extra_specs = {spec_key: "val3", "spec4": "val4"}
|
||||
body = self.admin_volume_types_client.create_volume_type_extra_specs(
|
||||
self.volume_type['id'], extra_specs)['extra_specs']
|
||||
self.assertEqual(extra_specs, body)
|
||||
body = self.admin_volume_types_client.list_volume_types_extra_specs(
|
||||
self.volume_type['id'])['extra_specs']
|
||||
for key in extra_specs:
|
||||
self.assertIn(key, body)
|
||||
self.assertEqual(extra_specs[key], body[key],
|
||||
"Volume type extra spec incorrectly created")
|
||||
|
||||
@decorators.idempotent_id('d4772798-601f-408a-b2a5-29e8a59d1220')
|
||||
def test_volume_type_extra_spec_create_get_delete(self):
|
||||
# Create/Get/Delete volume type extra spec.
|
||||
|
|
Loading…
Reference in New Issue