File tree Expand file tree Collapse file tree 1 file changed +6
-18
lines changed Expand file tree Collapse file tree 1 file changed +6
-18
lines changed Original file line number Diff line number Diff line change @@ -9,12 +9,6 @@ import (
99 "time"
1010)
1111
12- type tokenSource struct { token * Token }
13-
14- func (t * tokenSource ) Token () (* Token , error ) {
15- return t .token , nil
16- }
17-
1812func TestTransportNilTokenSource (t * testing.T ) {
1913 tr := & Transport {}
2014 server := newMockServer (func (w http.ResponseWriter , r * http.Request ) {})
@@ -88,13 +82,10 @@ func TestTransportCloseRequestBodySuccess(t *testing.T) {
8882}
8983
9084func TestTransportTokenSource (t * testing.T ) {
91- ts := & tokenSource {
92- token : & Token {
93- AccessToken : "abc" ,
94- },
95- }
9685 tr := & Transport {
97- Source : ts ,
86+ Source : StaticTokenSource (& Token {
87+ AccessToken : "abc" ,
88+ }),
9889 }
9990 server := newMockServer (func (w http.ResponseWriter , r * http.Request ) {
10091 if got , want := r .Header .Get ("Authorization" ), "Bearer abc" ; got != want {
@@ -123,14 +114,11 @@ func TestTransportTokenSourceTypes(t *testing.T) {
123114 {key : "basic" , val : val , want : "Basic abc" },
124115 }
125116 for _ , tc := range tests {
126- ts := & tokenSource {
127- token : & Token {
117+ tr := & Transport {
118+ Source : StaticTokenSource ( & Token {
128119 AccessToken : tc .val ,
129120 TokenType : tc .key ,
130- },
131- }
132- tr := & Transport {
133- Source : ts ,
121+ }),
134122 }
135123 server := newMockServer (func (w http.ResponseWriter , r * http.Request ) {
136124 if got , want := r .Header .Get ("Authorization" ), tc .want ; got != want {
You can’t perform that action at this time.
0 commit comments