def test_saves_pending_deletion_request_when_already_existing(self):
    pending_deletion_request_model_old = user_models.PendingDeletionRequestModel(id=self.user_1_id, email=self.USER_1_EMAIL, role=self.user_1_role, deletion_complete=False, pseudonymizable_entity_mappings={})
    pending_deletion_request_model_old.put()
    pending_deletion_request = wipeout_domain.PendingDeletionRequest.create_default(self.user_1_id, self.USER_1_EMAIL, self.user_1_role)
    pending_deletion_request.deletion_complete = True
    pending_deletion_request.pseudonymizable_entity_mappings = {'story': {'story_id': 'user_id'}}
    wipeout_service.save_pending_deletion_requests([pending_deletion_request])
    pending_deletion_request_model_new = user_models.PendingDeletionRequestModel.get_by_id(self.user_1_id)
    self.assertEqual(pending_deletion_request_model_new.id, self.user_1_id)
    self.assertEqual(pending_deletion_request_model_new.email, self.USER_1_EMAIL)
    self.assertEqual(pending_deletion_request_model_new.deletion_complete, True)
    self.assertEqual(pending_deletion_request_model_new.pseudonymizable_entity_mappings, {'story': {'story_id': 'user_id'}})
    self.assertEqual(pending_deletion_request_model_old.created_on, pending_deletion_request_model_new.created_on)
def test_saves_pending_deletion_request_when_already_existing(self):
    pending_deletion_request_model_old = user_models.PendingDeletionRequestModel(id=self.user_1_id, email=self.USER_1_EMAIL, role=self.user_1_role, deletion_complete=False, pseudonymizable_entity_mappings={})
    pending_deletion_request_model_old.put()
    pending_deletion_request = wipeout_domain.PendingDeletionRequest.create_default(self.user_1_id, self.USER_1_EMAIL, self.user_1_role)
    pending_deletion_request.deletion_complete = True
    pending_deletion_request.pseudonymizable_entity_mappings = {'story': {'story_id': 'user_id'}}
    wipeout_service.save_pending_deletion_requests([pending_deletion_request])
    pending_deletion_request_model_new = user_models.PendingDeletionRequestModel.get_by_id(self.user_1_id)
    self.assertEqual(pending_deletion_request_model_new.id, self.user_1_id)
    self.assertEqual(pending_deletion_request_model_new.email, self.USER_1_EMAIL)
    self.assertEqual(pending_deletion_request_model_new.deletion_complete, True)
    self.assertEqual(pending_deletion_request_model_new.pseudonymizable_entity_mappings, {'story': {'story_id': 'user_id'}})
    self.assertEqual(pending_deletion_request_model_old.created_on, pending_deletion_request_model_new.created_on)