@@ -52,11 +52,11 @@ func TestAzureDefaultIdentityProvider_RequestToken(t *testing.T) {
52
52
mCredFactory := & mockCredFactory {}
53
53
mCredFactory .On ("NewDefaultAzureCredential" , mock .Anything ).Return (mCreds , nil )
54
54
provider .credFactory = mCredFactory
55
- token , err = provider .RequestToken (context .Background ())
56
- assert .NotNil (t , token , "token should not be nil" )
57
- assert .NoError (t , err , "failed to request token " )
58
- assert .Equal (t , shared .ResponseTypeAccessToken , token .Type (), "token type should be access token " )
59
- assert .Equal (t , mToken , token .AccessToken (), "access token should be equal to testJWTToken" )
55
+ resp , err : = provider .RequestToken (context .Background ())
56
+ assert .NotNil (t , resp , "resp should not be nil" )
57
+ assert .NoError (t , err , "failed to request resp " )
58
+ assert .Equal (t , shared .ResponseTypeAccessToken , resp .Type (), "resp type should be access resp " )
59
+ assert .Equal (t , mToken , resp .(shared. AccessTokenIDPResponse ) .AccessToken (), "access token should be equal to testJWTToken" )
60
60
}
61
61
62
62
func TestAzureDefaultIdentityProvider_RequestTokenWithScopes (t * testing.T ) {
@@ -84,19 +84,19 @@ func TestAzureDefaultIdentityProvider_RequestTokenWithScopes(t *testing.T) {
84
84
mCredFactory := & mockCredFactory {}
85
85
mCredFactory .On ("NewDefaultAzureCredential" , mock .Anything ).Return (mCreds , nil )
86
86
provider .credFactory = mCredFactory
87
- token , err = provider .RequestToken (context .Background ())
88
- assert .NotNil (t , token , "token should not be nil" )
89
- assert .NoError (t , err , "failed to request token " )
90
- assert .Equal (t , shared .ResponseTypeAccessToken , token .Type (), "token type should be access token " )
91
- assert .Equal (t , mToken , token . AccessToken (), "access token should be equal to testJWTToken" )
87
+ resp , err : = provider .RequestToken (context .Background ())
88
+ assert .NotNil (t , resp , "resp should not be nil" )
89
+ assert .NoError (t , err , "failed to request resp " )
90
+ assert .Equal (t , shared .ResponseTypeAccessToken , resp .Type (), "resp type should be access resp " )
91
+ assert .Equal (t , mToken , resp .(shared. AccessTokenIDPResponse ). AccessToken (), "access resp should be equal to testJWTToken" )
92
92
})
93
93
t .Run ("RequestToken with error from credFactory" , func (t * testing.T ) {
94
94
// use mockAzureCredential to simulate the environment
95
95
mCredFactory := & mockCredFactory {}
96
96
mCredFactory .On ("NewDefaultAzureCredential" , mock .Anything ).Return (nil , assert .AnError )
97
97
provider .credFactory = mCredFactory
98
- token , err := provider .RequestToken (context .Background ())
99
- assert .Nil (t , token , "token should be nil" )
100
- assert .Error (t , err , "failed to request token " )
98
+ resp , err := provider .RequestToken (context .Background ())
99
+ assert .Nil (t , resp , "resp should be nil" )
100
+ assert .Error (t , err , "failed to request resp " )
101
101
})
102
102
}
0 commit comments