def test_one_story_with_missing_snapshot_is_pseudonymized(self):
    story_models.StoryCommitLogEntryModel(id=('story-%s-1' % self.STORY_2_ID), story_id=self.STORY_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 'StoryCommitLogEntryModel' and snapshot models ['StorySnapshotMetadataModel'] IDs differ. Snapshots without commit logs: [], commit logs without snapshots: [u'%s']." % self.STORY_2_ID)])
    story_mappings = user_models.PendingDeletionRequestModel.get_by_id(self.user_1_id).pseudonymizable_entity_mappings[models.NAMES.story]
    metadata_model = story_models.StorySnapshotMetadataModel.get_by_id(('%s-1' % self.STORY_1_ID))
    self.assertEqual(metadata_model.committer_id, story_mappings[self.STORY_1_ID])
    commit_log_model_1 = story_models.StoryCommitLogEntryModel.get_by_id(('story-%s-1' % self.STORY_1_ID))
    self.assertEqual(commit_log_model_1.user_id, story_mappings[self.STORY_1_ID])
    commit_log_model_2 = story_models.StoryCommitLogEntryModel.get_by_id(('story-%s-1' % self.STORY_2_ID))
    self.assertEqual(commit_log_model_2.user_id, story_mappings[self.STORY_2_ID])
def test_one_story_with_missing_snapshot_is_pseudonymized(self):
    story_models.StoryCommitLogEntryModel(id=('story-%s-1' % self.STORY_2_ID), story_id=self.STORY_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 'StoryCommitLogEntryModel' and snapshot models ['StorySnapshotMetadataModel'] IDs differ. Snapshots without commit logs: [], commit logs without snapshots: [u'%s']." % self.STORY_2_ID)])
    story_mappings = user_models.PendingDeletionRequestModel.get_by_id(self.user_1_id).pseudonymizable_entity_mappings[models.NAMES.story]
    metadata_model = story_models.StorySnapshotMetadataModel.get_by_id(('%s-1' % self.STORY_1_ID))
    self.assertEqual(metadata_model.committer_id, story_mappings[self.STORY_1_ID])
    commit_log_model_1 = story_models.StoryCommitLogEntryModel.get_by_id(('story-%s-1' % self.STORY_1_ID))
    self.assertEqual(commit_log_model_1.user_id, story_mappings[self.STORY_1_ID])
    commit_log_model_2 = story_models.StoryCommitLogEntryModel.get_by_id(('story-%s-1' % self.STORY_2_ID))
    self.assertEqual(commit_log_model_2.user_id, story_mappings[self.STORY_2_ID])