def test_one_skill_with_missing_snapshot_is_pseudonymized(self):
    skill_models.SkillCommitLogEntryModel(id=('skill-%s-1' % self.SKILL_2_ID), skill_id=self.SKILL_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 'SkillCommitLogEntryModel' and snapshot models ['SkillSnapshotMetadataModel'] IDs differ. Snapshots without commit logs: [], commit logs without snapshots: [u'%s']." % self.SKILL_2_ID)])
    skill_mappings = user_models.PendingDeletionRequestModel.get_by_id(self.user_1_id).pseudonymizable_entity_mappings[models.NAMES.skill]
    metadata_model = skill_models.SkillSnapshotMetadataModel.get_by_id(('%s-1' % self.SKILL_1_ID))
    self.assertEqual(metadata_model.committer_id, skill_mappings[self.SKILL_1_ID])
    commit_log_model_1 = skill_models.SkillCommitLogEntryModel.get_by_id(('skill-%s-1' % self.SKILL_1_ID))
    self.assertEqual(commit_log_model_1.user_id, skill_mappings[self.SKILL_1_ID])
    commit_log_model_2 = skill_models.SkillCommitLogEntryModel.get_by_id(('skill-%s-1' % self.SKILL_2_ID))
    self.assertEqual(commit_log_model_2.user_id, skill_mappings[self.SKILL_2_ID])
def test_one_skill_with_missing_snapshot_is_pseudonymized(self):
    skill_models.SkillCommitLogEntryModel(id=('skill-%s-1' % self.SKILL_2_ID), skill_id=self.SKILL_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 'SkillCommitLogEntryModel' and snapshot models ['SkillSnapshotMetadataModel'] IDs differ. Snapshots without commit logs: [], commit logs without snapshots: [u'%s']." % self.SKILL_2_ID)])
    skill_mappings = user_models.PendingDeletionRequestModel.get_by_id(self.user_1_id).pseudonymizable_entity_mappings[models.NAMES.skill]
    metadata_model = skill_models.SkillSnapshotMetadataModel.get_by_id(('%s-1' % self.SKILL_1_ID))
    self.assertEqual(metadata_model.committer_id, skill_mappings[self.SKILL_1_ID])
    commit_log_model_1 = skill_models.SkillCommitLogEntryModel.get_by_id(('skill-%s-1' % self.SKILL_1_ID))
    self.assertEqual(commit_log_model_1.user_id, skill_mappings[self.SKILL_1_ID])
    commit_log_model_2 = skill_models.SkillCommitLogEntryModel.get_by_id(('skill-%s-1' % self.SKILL_2_ID))
    self.assertEqual(commit_log_model_2.user_id, skill_mappings[self.SKILL_2_ID])