'Tests that cinder exceptions are correctly translated'

def _test_volume_translate_exception(self, cinder_exc, api_exc):

    def fake_volume_create(self, context, size, name, description, snapshot, **param):
        raise cinder_exc
    self.stubs.Set(cinder.API, 'create', fake_volume_create)
    vol = {'size': '10', 'display_name': 'Volume    Test    Name', 'display_description': 'Volume    Test    Desc', 'availability_zone': 'zone1:host1'}
    body = {'volume': vol}
    req = fakes.HTTPRequest.blank((self.url_prefix + '/os-volumes'))
    self.assertRaises(api_exc, volumes_v21.VolumeController().create, req, body=body)
