'Test the deletion of a cgsnapshot when a soft delete is required'

def test_delete_cgsnapshot(self):

    fake_cgsnapshot = copy.deepcopy(eseries_fake.FAKE_CINDER_CG_SNAPSHOT)
    fake_vol = cinder_utils.create_volume(self.ctxt)
    fake_snapshots = [cinder_utils.create_snapshot(self.ctxt, fake_vol['id'])]
    cg = copy.deepcopy(eseries_fake.FAKE_CONSISTENCY_GROUP)
    cg_snap = copy.deepcopy(eseries_fake.SNAPSHOT_IMAGE)
    cg_snap['pitSequenceNumber'] = str(max(cg['uniqueSequenceNumber']))
    cg_snaps = [cg_snap]
    for snap in fake_snapshots:
        snap['provider_id'] = cg_snap['id']
    vol = copy.deepcopy(eseries_fake.VOLUME)
    for snap in cg_snaps:
        snap['baseVol'] = vol['id']
    get_cg = self.mock_object(self.library, '_get_consistencygroup_by_name', return_value=cg)
    self.mock_object(self.library._client, 'delete_consistency_group_snapshot')
    self.mock_object(self.library._client, 'get_consistency_group_snapshots', return_value=cg_snaps)
    soft_del = self.mock_object(self.library, '_soft_delete_cgsnapshot', return_value=(None, None))
    (model_update, snap_updt) = self.library.delete_cgsnapshot(fake_cgsnapshot, fake_snapshots)
    self.assertIsNone(model_update)
    self.assertIsNone(snap_updt)
    get_cg.assert_called_once_with(utils.convert_uuid_to_es_fmt(fake_cgsnapshot['consistencygroup_id']))
    soft_del.assert_called_once_with(cg, cg_snap['pitSequenceNumber'])
