@@ -70,14 +70,14 @@ func TestGetClientSecretAuthorizer(t *testing.T) {
7070 env , err := aa .getAzureEnvironment ()
7171 require .NoError (t , err )
7272 aa .AzureEnvironment = & env
73- auth , err := aa .getClientSecretAuthorizer (armDatabricksResourceID )
73+ auth , err := aa .getClientSecretAuthorizer (azureDatabricksProdLoginAppID )
7474 require .Nil (t , auth )
7575 require .EqualError (t , err , "parameter 'clientID' cannot be empty" )
7676
7777 aa .AzureTenantID = "a"
7878 aa .AzureClientID = "b"
7979 aa .AzureClientSecret = "c"
80- auth , err = aa .getClientSecretAuthorizer (armDatabricksResourceID )
80+ auth , err = aa .getClientSecretAuthorizer (azureDatabricksProdLoginAppID )
8181 require .NotNil (t , auth )
8282 require .NoError (t , err )
8383
@@ -541,10 +541,46 @@ func TestSimpleAADRequestVisitor_FailPlatformAuth(t *testing.T) {
541541 },
542542 }).simpleAADRequestVisitor (context .Background (),
543543 func (resource string ) (autorest.Authorizer , error ) {
544- if resource == armDatabricksResourceID {
544+ if resource == azureDatabricksProdLoginAppID {
545545 return nil , fmt .Errorf ("🤨" )
546546 }
547547 return autorest.NullAuthorizer {}, nil
548548 })
549549 assert .EqualError (t , err , "cannot authorize databricks: 🤨" )
550550}
551+
552+ func TestSimpleAADRequestVisitor_ProdLoginAppId (t * testing.T ) {
553+ aa := DatabricksClient {
554+ Host : "abc.azuredatabricks.net" ,
555+ AzureEnvironment : & azure.Environment {
556+ ServiceManagementEndpoint : "x" ,
557+ },
558+ }
559+ _ , err := aa .simpleAADRequestVisitor (context .Background (),
560+ func (resource string ) (autorest.Authorizer , error ) {
561+ if resource == "x" {
562+ return autorest.NullAuthorizer {}, nil
563+ }
564+ assert .Equal (t , azureDatabricksProdLoginAppID , resource )
565+ return autorest.NullAuthorizer {}, nil
566+ })
567+ assert .Nil (t , err )
568+ }
569+
570+ func TestSimpleAADRequestVisitor_LoginAppIdOverride (t * testing.T ) {
571+ _ , err := (& DatabricksClient {
572+ Host : "abc.azuredatabricks.net" ,
573+ AzureEnvironment : & azure.Environment {
574+ ServiceManagementEndpoint : "x" ,
575+ },
576+ AzureDatabricksLoginAppId : "y" ,
577+ }).simpleAADRequestVisitor (context .Background (),
578+ func (resource string ) (autorest.Authorizer , error ) {
579+ if resource == "x" {
580+ return autorest.NullAuthorizer {}, nil
581+ }
582+ assert .Equal (t , "y" , resource )
583+ return autorest.NullAuthorizer {}, nil
584+ })
585+ assert .Nil (t , err )
586+ }
0 commit comments