File tree 1 file changed +6
-18
lines changed
1 file changed +6
-18
lines changed Original file line number Diff line number Diff line change @@ -9,12 +9,6 @@ import (
9
9
"time"
10
10
)
11
11
12
- type tokenSource struct { token * Token }
13
-
14
- func (t * tokenSource ) Token () (* Token , error ) {
15
- return t .token , nil
16
- }
17
-
18
12
func TestTransportNilTokenSource (t * testing.T ) {
19
13
tr := & Transport {}
20
14
server := newMockServer (func (w http.ResponseWriter , r * http.Request ) {})
@@ -88,13 +82,10 @@ func TestTransportCloseRequestBodySuccess(t *testing.T) {
88
82
}
89
83
90
84
func TestTransportTokenSource (t * testing.T ) {
91
- ts := & tokenSource {
92
- token : & Token {
93
- AccessToken : "abc" ,
94
- },
95
- }
96
85
tr := & Transport {
97
- Source : ts ,
86
+ Source : StaticTokenSource (& Token {
87
+ AccessToken : "abc" ,
88
+ }),
98
89
}
99
90
server := newMockServer (func (w http.ResponseWriter , r * http.Request ) {
100
91
if got , want := r .Header .Get ("Authorization" ), "Bearer abc" ; got != want {
@@ -123,14 +114,11 @@ func TestTransportTokenSourceTypes(t *testing.T) {
123
114
{key : "basic" , val : val , want : "Basic abc" },
124
115
}
125
116
for _ , tc := range tests {
126
- ts := & tokenSource {
127
- token : & Token {
117
+ tr := & Transport {
118
+ Source : StaticTokenSource ( & Token {
128
119
AccessToken : tc .val ,
129
120
TokenType : tc .key ,
130
- },
131
- }
132
- tr := & Transport {
133
- Source : ts ,
121
+ }),
134
122
}
135
123
server := newMockServer (func (w http.ResponseWriter , r * http.Request ) {
136
124
if got , want := r .Header .Get ("Authorization" ), tc .want ; got != want {
You can’t perform that action at this time.
0 commit comments