Merge "Fix test case for updating volume type extra specs"

This commit is contained in:
Zuul 2017-10-25 04:13:35 +00:00 committed by Gerrit Code Review
commit a273b0fe19
1 changed files with 18 additions and 0 deletions

View File

@ -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.