def test_user_app_token_auth(): token = "123456446" user_kcsb = KustoConnectionStringBuilder.with_aad_user_token_authentication( KUSTO_TEST_URI, token) app_kcsb = KustoConnectionStringBuilder.with_aad_application_token_authentication( KUSTO_TEST_URI, token) user_helper = _AadHelper(user_kcsb) app_helper = _AadHelper(app_kcsb) auth_header = user_helper.acquire_authorization_header() assert auth_header.index(token) > -1 auth_header = app_helper.acquire_authorization_header() assert auth_header.index(token) > -1
def test_aad_app_token(self): """Checks kcsb that is created with AAD user token.""" token = "The app hardest token ever" kcsb = KustoConnectionStringBuilder.with_aad_application_token_authentication( "localhost", application_token=token) assert kcsb.data_source == "localhost" assert kcsb.application_token == token assert kcsb.aad_federated_security assert kcsb.aad_user_id is None assert kcsb.password is None assert kcsb.application_client_id is None assert kcsb.application_key is None assert kcsb.user_token is None assert kcsb.authority_id == "common" assert repr( kcsb ) == "Data Source=localhost;AAD Federated Security=True;Authority Id=common;Application Token=%s" % token assert str( kcsb ) == "Data Source=localhost;AAD Federated Security=True;Authority Id=common;Application Token=%s" % self.PASSWORDS_REPLACEMENT