def test_one_question_with_missing_snapshot_is_pseudonymized(self):
    question_models.QuestionCommitLogEntryModel(id=('question-%s-1' % self.QUESTION_2_ID), question_id=self.QUESTION_2_ID, user_id=self.user_1_id, commit_type='create_new', commit_cmds=[{}], post_commit_status=constants.ACTIVITY_STATUS_PUBLIC, version=1).put_for_human()
    with self.capture_logging(min_level=logging.ERROR) as log_messages:
        wipeout_service.delete_user(wipeout_service.get_pending_deletion_request(self.user_1_id))
    self.assertEqual(log_messages, [("[WIPEOUT] The commit log model 'QuestionCommitLogEntryModel' and snapshot models ['QuestionSnapshotMetadataModel'] IDs differ. Snapshots without commit logs: [], commit logs without snapshots: [u'%s']." % self.QUESTION_2_ID)])
    question_mappings = user_models.PendingDeletionRequestModel.get_by_id(self.user_1_id).pseudonymizable_entity_mappings[models.NAMES.question]
    metadata_model = question_models.QuestionSnapshotMetadataModel.get_by_id(('%s-1' % self.QUESTION_1_ID))
    self.assertEqual(metadata_model.committer_id, question_mappings[self.QUESTION_1_ID])
    commit_log_model_1 = question_models.QuestionCommitLogEntryModel.get_by_id(('question-%s-1' % self.QUESTION_1_ID))
    self.assertEqual(commit_log_model_1.user_id, question_mappings[self.QUESTION_1_ID])
    commit_log_model_2 = question_models.QuestionCommitLogEntryModel.get_by_id(('question-%s-1' % self.QUESTION_2_ID))
    self.assertEqual(commit_log_model_2.user_id, question_mappings[self.QUESTION_2_ID])
def test_one_question_with_missing_snapshot_is_pseudonymized(self):
    question_models.QuestionCommitLogEntryModel(id=('question-%s-1' % self.QUESTION_2_ID), question_id=self.QUESTION_2_ID, user_id=self.user_1_id, commit_type='create_new', commit_cmds=[{}], post_commit_status=constants.ACTIVITY_STATUS_PUBLIC, version=1).put_for_human()
    with self.capture_logging(min_level=logging.ERROR) as log_messages:
        wipeout_service.delete_user(wipeout_service.get_pending_deletion_request(self.user_1_id))
    self.assertEqual(log_messages, [("[WIPEOUT] The commit log model 'QuestionCommitLogEntryModel' and snapshot models ['QuestionSnapshotMetadataModel'] IDs differ. Snapshots without commit logs: [], commit logs without snapshots: [u'%s']." % self.QUESTION_2_ID)])
    question_mappings = user_models.PendingDeletionRequestModel.get_by_id(self.user_1_id).pseudonymizable_entity_mappings[models.NAMES.question]
    metadata_model = question_models.QuestionSnapshotMetadataModel.get_by_id(('%s-1' % self.QUESTION_1_ID))
    self.assertEqual(metadata_model.committer_id, question_mappings[self.QUESTION_1_ID])
    commit_log_model_1 = question_models.QuestionCommitLogEntryModel.get_by_id(('question-%s-1' % self.QUESTION_1_ID))
    self.assertEqual(commit_log_model_1.user_id, question_mappings[self.QUESTION_1_ID])
    commit_log_model_2 = question_models.QuestionCommitLogEntryModel.get_by_id(('question-%s-1' % self.QUESTION_2_ID))
    self.assertEqual(commit_log_model_2.user_id, question_mappings[self.QUESTION_2_ID])