def test_add_async_token_provider(self):
        caller_token = "caller token"

        async def async_token_provider():
            return caller_token

        kscb = KustoConnectionStringBuilder.with_async_token_provider(
            "localhost", async_token_provider)

        assert kscb.async_token_provider() is not None

        exception_occurred = False
        try:
            kscb = KustoConnectionStringBuilder.with_async_token_provider(
                "localhost", caller_token)
        except AssertionError as ex:
            exception_occurred = True
        finally:
            assert exception_occurred
def proxy_kcsb(request) -> Tuple[KustoConnectionStringBuilder, bool]:
    cluster = KustoClientTestsMixin.HOST
    user = "******"
    password = "******"
    authority_id = "13456"
    uuid = "11111111-1111-1111-1111-111111111111"
    key = "key of application"
    token = "The app hardest token ever"

    return {
        "user_password":
        (KustoConnectionStringBuilder.with_aad_user_password_authentication(
            cluster, user, password, authority_id), True),
        "application_key":
        (KustoConnectionStringBuilder.with_aad_application_key_authentication(
            cluster, uuid, key, "microsoft.com"), True),
        "application_token": (KustoConnectionStringBuilder.
                              with_aad_application_token_authentication(
                                  cluster, application_token=token), False),
        "device":
        (KustoConnectionStringBuilder.with_aad_device_authentication(cluster),
         True),
        "user_token":
        (KustoConnectionStringBuilder.with_aad_user_token_authentication(
            cluster, user_token=token), False),
        "managed_identity":
        (KustoConnectionStringBuilder.
         with_aad_managed_service_identity_authentication(cluster), False),
        "token_provider": (KustoConnectionStringBuilder.with_token_provider(
            cluster, lambda x: x), False),
        "async_token_provider":
        (KustoConnectionStringBuilder.with_async_token_provider(
            cluster, lambda x: x), False),
        "az_cli":
        (KustoConnectionStringBuilder.with_az_cli_authentication(cluster),
         True),
        "interactive_login":
        (KustoConnectionStringBuilder.with_interactive_login(cluster), True),
    }[request.param]