Skip to content

Commit a860885

Browse files
committed
Modify setup from stirng and include test.
1 parent 4ee0539 commit a860885

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

google/google.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,8 @@ func Setup(redirectURL, credFile string, scopes []string, secret []byte) {
7878
}
7979

8080
// Setup the authorization path without a config file
81-
func SetupFromString(redirectURL, cLoginURL string, clientID string, clientSecret string, scopes []string, secret []byte) {
81+
func SetupFromString(redirectURL, clientID string, clientSecret string, scopes []string, secret []byte) {
8282
store = cookie.NewStore(secret)
83-
loginURL = cLoginURL
8483

8584
conf = &oauth2.Config{
8685
ClientID: clientID,

google/google_test.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package google
2+
3+
import (
4+
"testing"
5+
6+
"github.com/stretchr/testify/assert"
7+
)
8+
9+
func TestSetupFromString(t *testing.T) {
10+
t.Run("should assign store and config accordingly", func(t *testing.T) {
11+
store = nil
12+
conf = nil
13+
SetupFromString("http://fake.fake", "clientid", "clientsecret", []string{}, []byte("secret"))
14+
assert.NotNil(t, conf)
15+
assert.NotNil(t, store)
16+
assert.Equal(t, conf.ClientID, "clientid")
17+
assert.Equal(t, conf.ClientSecret, "clientsecret")
18+
})
19+
}

0 commit comments

Comments
 (0)