def test_run_user_deletion_completion_with_user_wrongly_deleted(self):
    wipeout_service.run_user_deletion(self.pending_deletion_request)
    user_models.CompletedActivitiesModel(id=self.user_1_id, exploration_ids=[], collection_ids=[]).put()
    email_content = ("The Wipeout process failed for the user with ID '%s' and email '%s'." % (self.user_1_id, self.USER_1_EMAIL))
    send_email_swap = self.swap_with_checks(email_manager, 'send_mail_to_admin', (lambda x, y: None), expected_args=[('WIPEOUT: Account deletion failed', email_content)])
    with send_email_swap:
        self.assertEqual(wipeout_service.run_user_deletion_completion(self.pending_deletion_request), wipeout_domain.USER_VERIFICATION_FAILURE)
    self.assertIsNotNone(user_models.UserSettingsModel.get_by_id(self.user_1_id))
    self.assertIsNotNone(auth_models.UserAuthDetailsModel.get_by_id(self.user_1_id))
    self.assertIsNotNone(user_models.PendingDeletionRequestModel.get_by_id(self.user_1_id))
def test_run_user_deletion_completion_with_user_wrongly_deleted(self):
    wipeout_service.run_user_deletion(self.pending_deletion_request)
    user_models.CompletedActivitiesModel(id=self.user_1_id, exploration_ids=[], collection_ids=[]).put()
    email_content = ("The Wipeout process failed for the user with ID '%s' and email '%s'." % (self.user_1_id, self.USER_1_EMAIL))
    send_email_swap = self.swap_with_checks(email_manager, 'send_mail_to_admin', (lambda x, y: None), expected_args=[('WIPEOUT: Account deletion failed', email_content)])
    with send_email_swap:
        self.assertEqual(wipeout_service.run_user_deletion_completion(self.pending_deletion_request), wipeout_domain.USER_VERIFICATION_FAILURE)
    self.assertIsNotNone(user_models.UserSettingsModel.get_by_id(self.user_1_id))
    self.assertIsNotNone(auth_models.UserAuthDetailsModel.get_by_id(self.user_1_id))
    self.assertIsNotNone(user_models.PendingDeletionRequestModel.get_by_id(self.user_1_id))