def test_one_subtopic_with_missing_snapshot_is_pseudonymized(self):
    subtopic_models.SubtopicPageCommitLogEntryModel(id=('%s-%s-1' % (self.TOP_1_ID, self.SUBTOP_2_ID)), subtopic_page_id=self.SUBTOP_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 'SubtopicPageCommitLogEntryModel' and snapshot models ['SubtopicPageSnapshotMetadataModel'] IDs differ. Snapshots without commit logs: [], commit logs without snapshots: [u'%s']." % self.SUBTOP_2_ID)])
    subtopic_mappings = user_models.PendingDeletionRequestModel.get_by_id(self.user_1_id).pseudonymizable_entity_mappings[models.NAMES.subtopic]
    metadata_model = subtopic_models.SubtopicPageSnapshotMetadataModel.get_by_id(('%s-%s-1' % (self.TOP_1_ID, self.SUBTOP_1_ID)))
    self.assertEqual(metadata_model.committer_id, subtopic_mappings[('%s-%s' % (self.TOP_1_ID, self.SUBTOP_1_ID))])
    commit_log_model = subtopic_models.SubtopicPageCommitLogEntryModel.get_by_id(('subtopicpage-%s-%s-1' % (self.TOP_1_ID, self.SUBTOP_1_ID)))
    self.assertEqual(commit_log_model.user_id, subtopic_mappings[('%s-%s' % (self.TOP_1_ID, self.SUBTOP_1_ID))])
def test_one_subtopic_with_missing_snapshot_is_pseudonymized(self):
    subtopic_models.SubtopicPageCommitLogEntryModel(id=('%s-%s-1' % (self.TOP_1_ID, self.SUBTOP_2_ID)), subtopic_page_id=self.SUBTOP_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 'SubtopicPageCommitLogEntryModel' and snapshot models ['SubtopicPageSnapshotMetadataModel'] IDs differ. Snapshots without commit logs: [], commit logs without snapshots: [u'%s']." % self.SUBTOP_2_ID)])
    subtopic_mappings = user_models.PendingDeletionRequestModel.get_by_id(self.user_1_id).pseudonymizable_entity_mappings[models.NAMES.subtopic]
    metadata_model = subtopic_models.SubtopicPageSnapshotMetadataModel.get_by_id(('%s-%s-1' % (self.TOP_1_ID, self.SUBTOP_1_ID)))
    self.assertEqual(metadata_model.committer_id, subtopic_mappings[('%s-%s' % (self.TOP_1_ID, self.SUBTOP_1_ID))])
    commit_log_model = subtopic_models.SubtopicPageCommitLogEntryModel.get_by_id(('subtopicpage-%s-%s-1' % (self.TOP_1_ID, self.SUBTOP_1_ID)))
    self.assertEqual(commit_log_model.user_id, subtopic_mappings[('%s-%s' % (self.TOP_1_ID, self.SUBTOP_1_ID))])