'Test update volume metadata with different metadata type.'

def test_update_volume_metadata_with_metatype(self):

    test_meta1 = {'fake_key1': 'fake_value1'}
    test_meta2 = {'fake_key1': 'fake_value2'}
    FAKE_METADATA_TYPE = enum.Enum('METADATA_TYPES', 'fake_type')
    volume = tests_utils.create_volume(self.context, metadata=test_meta1, **self.volume_params)
    self.volume.create_volume(self.context, volume)
    result_meta = self.volume_api.update_volume_metadata(self.context, volume, test_meta2, False, common.METADATA_TYPES.user)
    self.assertEqual(test_meta2, result_meta)
    result_meta = self.volume_api.update_volume_metadata(self.context, volume, test_meta1, False, common.METADATA_TYPES.image)
    self.assertEqual(test_meta1, result_meta)
    result_meta = self.volume_api.update_volume_metadata(self.context, volume, test_meta2, False, common.METADATA_TYPES.image)
    self.assertEqual(test_meta2, result_meta)
    self.assertRaises(exception.InvalidMetadataType, self.volume_api.update_volume_metadata, self.context, volume, test_meta1, False, FAKE_METADATA_TYPE.fake_type)
