'Test to complete deletion for instances in DELETED status but not
marked as deleted in the DB'

@mock.patch.object(objects.BlockDeviceMapping, 'destroy')
@mock.patch.object(objects.BlockDeviceMappingList, 'get_by_instance_uuid')
@mock.patch.object(objects.Instance, 'destroy')
@mock.patch.object(objects.Instance, 'obj_load_attr')
@mock.patch.object(objects.quotas, 'ids_from_instance')
def test_init_instance_complete_partial_deletion(self, mock_ids_from_instance, mock_inst_destroy, mock_obj_load_attr, mock_get_by_instance_uuid, mock_bdm_destroy):

    instance = fake_instance.fake_instance_obj(self.context, project_id=fakes.FAKE_PROJECT_ID, uuid=uuids.instance, vcpus=1, memory_mb=64, power_state=power_state.SHUTDOWN, vm_state=vm_states.DELETED, host=self.compute.host, task_state=None, deleted=False, deleted_at=None, metadata={}, system_metadata={}, expected_attrs=['metadata', 'system_metadata'])
    self.assertEqual(vm_states.DELETED, instance.vm_state)
    self.assertFalse(instance.deleted)
    def fake_inst_destroy():
        instance.deleted = True
        instance.deleted_at = timeutils.utcnow()
    mock_ids_from_instance.return_value = (instance.project_id, instance.user_id)
    mock_inst_destroy.side_effect = fake_inst_destroy()
    self.compute._init_instance(self.context, instance)
    self.assertNotEqual(0, instance.deleted)
