11package config
22
33import (
4+ "errors"
45 "net/http"
56 "net/url"
67 "sort"
@@ -9,7 +10,6 @@ import (
910
1011 "github.com/databricks/databricks-sdk-go/credentials/u2m"
1112 "github.com/databricks/databricks-sdk-go/httpclient/fixtures"
12- "github.com/stretchr/testify/require"
1313 "golang.org/x/oauth2"
1414)
1515
@@ -93,7 +93,9 @@ func TestM2mNotSupported(t *testing.T) {
9393 },
9494 },
9595 })
96- require .ErrorIs (t , err , u2m .ErrOAuthNotSupported )
96+ if ! errors .Is (err , u2m .ErrOAuthNotSupported ) {
97+ t .Errorf ("got error %v, want %v" , err , u2m .ErrOAuthNotSupported )
98+ }
9799}
98100
99101func TestM2M_Scopes (t * testing.T ) {
@@ -231,8 +233,12 @@ func TestM2M_Scopes(t *testing.T) {
231233 cfg .ConfigFile = "/dev/null"
232234 req , _ := http .NewRequest ("GET" , "http://localhost" , nil )
233235 err := cfg .Authenticate (req )
234- require .NoError (t , err )
235- require .Equal (t , "Bearer " + tt .expectedToken , req .Header .Get ("Authorization" ))
236+ if err != nil {
237+ t .Fatalf ("Authenticate(): unexpected error: %v" , err )
238+ }
239+ if got , want := req .Header .Get ("Authorization" ), "Bearer " + tt .expectedToken ; got != want {
240+ t .Errorf ("Authorization header: got %q, want %q" , got , want )
241+ }
236242 })
237243 }
238244}
0 commit comments