def test_delete_user_with_collections_and_explorations_is_successful(self):
    self.save_new_valid_exploration(self.EXPLORATION_1_ID, self.user_1_id)
    self.save_new_valid_collection(self.COLLECTION_1_ID, self.user_1_id, exploration_id=self.EXPLORATION_1_ID)
    self.save_new_valid_exploration(self.EXPLORATION_2_ID, self.user_1_id)
    self.save_new_valid_collection(self.COLLECTION_2_ID, self.user_1_id, exploration_id=self.EXPLORATION_2_ID)
    wipeout_service.pre_delete_user(self.user_1_id)
    self.process_and_flush_pending_tasks()
    self.assertIsNotNone(user_models.UserEmailPreferencesModel.get_by_id(self.user_1_id))
    self.assertIsNone(collection_models.CollectionModel.get_by_id(self.COLLECTION_1_ID))
    self.assertIsNone(exp_models.ExplorationModel.get_by_id(self.EXPLORATION_1_ID))
    self.assertIsNone(collection_models.CollectionModel.get_by_id(self.COLLECTION_2_ID))
    self.assertIsNone(exp_models.ExplorationModel.get_by_id(self.EXPLORATION_2_ID))
    wipeout_service.delete_user(wipeout_service.get_pending_deletion_request(self.user_1_id))
    wipeout_service.delete_user(wipeout_service.get_pending_deletion_request(self.profile_user_id))
    self.assertIsNone(user_models.UserEmailPreferencesModel.get_by_id(self.user_1_id))
    self.assertIsNone(collection_models.CollectionModel.get_by_id(self.COLLECTION_1_ID))
    self.assertIsNone(exp_models.ExplorationModel.get_by_id(self.EXPLORATION_1_ID))
    self.assertIsNone(collection_models.CollectionModel.get_by_id(self.COLLECTION_2_ID))
    self.assertIsNone(exp_models.ExplorationModel.get_by_id(self.EXPLORATION_2_ID))
def test_delete_user_with_collections_and_explorations_is_successful(self):
    self.save_new_valid_exploration(self.EXPLORATION_1_ID, self.user_1_id)
    self.save_new_valid_collection(self.COLLECTION_1_ID, self.user_1_id, exploration_id=self.EXPLORATION_1_ID)
    self.save_new_valid_exploration(self.EXPLORATION_2_ID, self.user_1_id)
    self.save_new_valid_collection(self.COLLECTION_2_ID, self.user_1_id, exploration_id=self.EXPLORATION_2_ID)
    wipeout_service.pre_delete_user(self.user_1_id)
    self.process_and_flush_pending_tasks()
    self.assertIsNotNone(user_models.UserEmailPreferencesModel.get_by_id(self.user_1_id))
    self.assertIsNone(collection_models.CollectionModel.get_by_id(self.COLLECTION_1_ID))
    self.assertIsNone(exp_models.ExplorationModel.get_by_id(self.EXPLORATION_1_ID))
    self.assertIsNone(collection_models.CollectionModel.get_by_id(self.COLLECTION_2_ID))
    self.assertIsNone(exp_models.ExplorationModel.get_by_id(self.EXPLORATION_2_ID))
    wipeout_service.delete_user(wipeout_service.get_pending_deletion_request(self.user_1_id))
    wipeout_service.delete_user(wipeout_service.get_pending_deletion_request(self.profile_user_id))
    self.assertIsNone(user_models.UserEmailPreferencesModel.get_by_id(self.user_1_id))
    self.assertIsNone(collection_models.CollectionModel.get_by_id(self.COLLECTION_1_ID))
    self.assertIsNone(exp_models.ExplorationModel.get_by_id(self.EXPLORATION_1_ID))
    self.assertIsNone(collection_models.CollectionModel.get_by_id(self.COLLECTION_2_ID))
    self.assertIsNone(exp_models.ExplorationModel.get_by_id(self.EXPLORATION_2_ID))