File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed
Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -3,12 +3,13 @@ package auth
33import (
44 "encoding/json"
55 "fmt"
6- "github.com/cloudquery/cloudquery-api-go/config"
76 "io"
87 "net/http"
98 "net/url"
109 "os"
1110 "time"
11+
12+ "github.com/cloudquery/cloudquery-api-go/config"
1213)
1314
1415const (
@@ -44,6 +45,10 @@ type Token struct {
4445 Value string
4546}
4647
48+ func (t Token ) String () string {
49+ return t .Value
50+ }
51+
4752type TokenClient struct {
4853 url string
4954 apiKey string
Original file line number Diff line number Diff line change @@ -3,12 +3,13 @@ package auth
33import (
44 "encoding/json"
55 "fmt"
6- "github.com/stretchr/testify/require"
76 "net/http"
87 "net/http/httptest"
98 "os"
109 "testing"
1110 "time"
11+
12+ "github.com/stretchr/testify/require"
1213)
1314
1415func TestRefreshToken_RoundTrip (t * testing.T ) {
@@ -39,6 +40,12 @@ func TestRefreshToken_Removal(t *testing.T) {
3940 require .Error (t , err )
4041}
4142
43+ func TestToken_Stringer (t * testing.T ) {
44+ token := Token {Type : BearerToken , Value : "my_token" }
45+ out := fmt .Sprintf ("Bearer %s" , token )
46+ require .Equal (t , "Bearer my_token" , out )
47+ }
48+
4249func TestTokenClient_EnvironmentVariable (t * testing.T ) {
4350 reset := overrideEnvironmentVariable (t , EnvVarCloudQueryAPIKey , "my_token" )
4451 defer reset ()
You can’t perform that action at this time.
0 commit comments