def test_one_subtopic_with_multiple_users_is_pseudonymized(self):
    subtopic_page_services.save_subtopic_page(self.user_2_id, self.subtopic_page, 'Change subtopic', [subtopic_page_domain.SubtopicPageChange({'cmd': subtopic_page_domain.CMD_UPDATE_SUBTOPIC_PAGE_PROPERTY, 'property_name': subtopic_page_domain.SUBTOPIC_PAGE_PROPERTY_PAGE_CONTENTS_HTML, 'new_value': 'new value', 'old_value': 'old value', 'subtopic_id': self.SUBTOP_1_ID})])
    wipeout_service.delete_user(wipeout_service.get_pending_deletion_request(self.user_1_id))
    subtopic_mappings_1 = 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_1[('%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_1[('%s-%s' % (self.TOP_1_ID, self.SUBTOP_1_ID))])
    metadata_model = subtopic_models.SubtopicPageSnapshotMetadataModel.get_by_id(('%s-%s-2' % (self.TOP_1_ID, self.SUBTOP_1_ID)))
    self.assertEqual(metadata_model.committer_id, self.user_2_id)
    commit_log_model = subtopic_models.SubtopicPageCommitLogEntryModel.get_by_id(('subtopicpage-%s-%s-2' % (self.TOP_1_ID, self.SUBTOP_1_ID)))
    self.assertEqual(commit_log_model.user_id, self.user_2_id)
    wipeout_service.delete_user(wipeout_service.get_pending_deletion_request(self.user_2_id))
    subtopic_mappings_2 = user_models.PendingDeletionRequestModel.get_by_id(self.user_2_id).pseudonymizable_entity_mappings[models.NAMES.subtopic]
    metadata_model = subtopic_models.SubtopicPageSnapshotMetadataModel.get_by_id(('%s-%s-2' % (self.TOP_1_ID, self.SUBTOP_1_ID)))
    self.assertEqual(metadata_model.committer_id, subtopic_mappings_2[('%s-%s' % (self.TOP_1_ID, self.SUBTOP_1_ID))])
    commit_log_model = subtopic_models.SubtopicPageCommitLogEntryModel.get_by_id(('subtopicpage-%s-%s-2' % (self.TOP_1_ID, self.SUBTOP_1_ID)))
    self.assertEqual(commit_log_model.user_id, subtopic_mappings_2[('%s-%s' % (self.TOP_1_ID, self.SUBTOP_1_ID))])
def test_one_subtopic_with_multiple_users_is_pseudonymized(self):
    subtopic_page_services.save_subtopic_page(self.user_2_id, self.subtopic_page, 'Change subtopic', [subtopic_page_domain.SubtopicPageChange({'cmd': subtopic_page_domain.CMD_UPDATE_SUBTOPIC_PAGE_PROPERTY, 'property_name': subtopic_page_domain.SUBTOPIC_PAGE_PROPERTY_PAGE_CONTENTS_HTML, 'new_value': 'new value', 'old_value': 'old value', 'subtopic_id': self.SUBTOP_1_ID})])
    wipeout_service.delete_user(wipeout_service.get_pending_deletion_request(self.user_1_id))
    subtopic_mappings_1 = 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_1[('%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_1[('%s-%s' % (self.TOP_1_ID, self.SUBTOP_1_ID))])
    metadata_model = subtopic_models.SubtopicPageSnapshotMetadataModel.get_by_id(('%s-%s-2' % (self.TOP_1_ID, self.SUBTOP_1_ID)))
    self.assertEqual(metadata_model.committer_id, self.user_2_id)
    commit_log_model = subtopic_models.SubtopicPageCommitLogEntryModel.get_by_id(('subtopicpage-%s-%s-2' % (self.TOP_1_ID, self.SUBTOP_1_ID)))
    self.assertEqual(commit_log_model.user_id, self.user_2_id)
    wipeout_service.delete_user(wipeout_service.get_pending_deletion_request(self.user_2_id))
    subtopic_mappings_2 = user_models.PendingDeletionRequestModel.get_by_id(self.user_2_id).pseudonymizable_entity_mappings[models.NAMES.subtopic]
    metadata_model = subtopic_models.SubtopicPageSnapshotMetadataModel.get_by_id(('%s-%s-2' % (self.TOP_1_ID, self.SUBTOP_1_ID)))
    self.assertEqual(metadata_model.committer_id, subtopic_mappings_2[('%s-%s' % (self.TOP_1_ID, self.SUBTOP_1_ID))])
    commit_log_model = subtopic_models.SubtopicPageCommitLogEntryModel.get_by_id(('subtopicpage-%s-%s-2' % (self.TOP_1_ID, self.SUBTOP_1_ID)))
    self.assertEqual(commit_log_model.user_id, subtopic_mappings_2[('%s-%s' % (self.TOP_1_ID, self.SUBTOP_1_ID))])