コード例 #1
0
    def test_delete_association_when_it_is_present(self) -> None:
        self.assertFalse(
            auth_services.verify_external_auth_associations_are_deleted(
                self.full_user_id))

        auth_services.delete_external_auth_associations(self.full_user_id)

        self.assertTrue(
            auth_services.verify_external_auth_associations_are_deleted(
                self.full_user_id))
コード例 #2
0
def verify_user_deleted(user_id, include_delete_at_end_models=False):
    """Verify that all the models for user specified in pending_deletion_request
    are deleted.

    Args:
        user_id: str. The ID of the user whose deletion should be verified.
        include_delete_at_end_models: bool. Whether to skip models
            that have deletion policy equal to 'DELETE_AT_END'.

    Returns:
        bool. True if all the models were correctly deleted, False otherwise.
    """
    if not auth_services.verify_external_auth_associations_are_deleted(
            user_id):
        return False

    policies_not_to_verify = [
        base_models.DELETION_POLICY.KEEP,
        base_models.DELETION_POLICY.NOT_APPLICABLE
    ]
    if not include_delete_at_end_models:
        policies_not_to_verify.append(
            base_models.DELETION_POLICY.DELETE_AT_END)

    user_is_verified = True
    for model_class in models.Registry.get_all_storage_model_classes():
        if (model_class.get_deletion_policy() not in policies_not_to_verify
                and model_class.has_reference_to_user_id(user_id)):
            logging.error('%s %s is not deleted for user with ID %s' %
                          (WIPEOUT_LOGS_PREFIX, model_class.__name__, user_id))
            user_is_verified = False
    return user_is_verified
コード例 #3
0
 def test_missing_association_is_considered_to_be_deleted(self) -> None:
     self.assertTrue(
         auth_services.verify_external_auth_associations_are_deleted(
             'does_not_exist'))
コード例 #4
0
 def test_present_association_is_not_considered_to_be_deleted(self) -> None:
     auth_services.associate_auth_id_with_user_id(
         auth_domain.AuthIdUserIdPair('aid', 'uid'))
     self.assertFalse(
         auth_services.verify_external_auth_associations_are_deleted('uid'))