@@ -117,15 +117,15 @@ func TestNewBearerTokenFromHTTPResponseBody(t *testing.T) {
117
117
},
118
118
{ // "token"
119
119
input : `{"token":"IAmAToken","expires_in":100,"issued_at":"2018-01-01T10:00:02+00:00"}` ,
120
- expected : & bearerToken {token : "IAmAToken" , ExpiresIn : 100 , IssuedAt : time . Unix ( 1514800802 , 0 ), expirationTime : time .Unix (1514800802 + 100 , 0 )},
120
+ expected : & bearerToken {token : "IAmAToken" , expirationTime : time .Unix (1514800802 + 100 , 0 )},
121
121
},
122
122
{ // "access_token"
123
123
input : `{"access_token":"IAmAToken","expires_in":100,"issued_at":"2018-01-01T10:00:02+00:00"}` ,
124
- expected : & bearerToken {token : "IAmAToken" , ExpiresIn : 100 , IssuedAt : time . Unix ( 1514800802 , 0 ), expirationTime : time .Unix (1514800802 + 100 , 0 )},
124
+ expected : & bearerToken {token : "IAmAToken" , expirationTime : time .Unix (1514800802 + 100 , 0 )},
125
125
},
126
126
{ // Small expiry
127
127
input : `{"token":"IAmAToken","expires_in":1,"issued_at":"2018-01-01T10:00:02+00:00"}` ,
128
- expected : & bearerToken {token : "IAmAToken" , ExpiresIn : 60 , IssuedAt : time . Unix ( 1514800802 , 0 ), expirationTime : time .Unix (1514800802 + 60 , 0 )},
128
+ expected : & bearerToken {token : "IAmAToken" , expirationTime : time .Unix (1514800802 + 60 , 0 )},
129
129
},
130
130
} {
131
131
token , err := newBearerTokenFromHTTPResponseBody (testTokenHTTPResponse (t , c .input ))
@@ -134,9 +134,6 @@ func TestNewBearerTokenFromHTTPResponseBody(t *testing.T) {
134
134
} else {
135
135
require .NoError (t , err , c .input )
136
136
assert .Equal (t , c .expected .token , token .token , c .input )
137
- assert .Equal (t , c .expected .ExpiresIn , token .ExpiresIn , c .input )
138
- assert .True (t , c .expected .IssuedAt .Equal (token .IssuedAt ),
139
- "expected [%s] to equal [%s], it did not" , token .IssuedAt , c .expected .IssuedAt )
140
137
assert .True (t , c .expected .expirationTime .Equal (token .expirationTime ),
141
138
"expected [%s] to equal [%s], it did not" , token .expirationTime , c .expected .expirationTime )
142
139
}
@@ -149,7 +146,6 @@ func TestNewBearerTokenFromHTTPResponseBodyIssuedAtZero(t *testing.T) {
149
146
tokenBlob := fmt .Sprintf (`{"token":"IAmAToken","expires_in":100,"issued_at":"%s"}` , zeroTime )
150
147
token , err := newBearerTokenFromHTTPResponseBody (testTokenHTTPResponse (t , tokenBlob ))
151
148
require .NoError (t , err )
152
- assert .False (t , token .IssuedAt .Before (now ), "expected [%s] not to be before [%s]" , token .IssuedAt , now )
153
149
expectedExpiration := now .Add (time .Duration (100 ) * time .Second )
154
150
require .False (t , token .expirationTime .Before (expectedExpiration ),
155
151
"expected [%s] not to be before [%s]" , token .expirationTime , expectedExpiration )
0 commit comments