'Test volume deletion with dependent snapshots.'

def test_cascade_delete_volume_with_snapshots_error(self):

    volume = tests_utils.create_volume(self.context, **self.volume_params)
    self.volume.create_volume(self.context, volume)
    snapshot = create_snapshot(volume['id'], size=volume['size'])
    self.volume.create_snapshot(self.context, snapshot)
    self.assertEqual(snapshot.id, objects.Snapshot.get_by_id(self.context, snapshot.id).id)
    snapshot.update({'status': fields.SnapshotStatus.CREATING})
    snapshot.save()
    volume['status'] = 'available'
    volume['host'] = 'fakehost'
    volume_api = cinder.volume.api.API()
    self.assertRaises(exception.InvalidVolume, volume_api.delete, self.context, volume, cascade=True)
