Skip to content

Commit be30822

Browse files
committed
Add with login url.
1 parent a860885 commit be30822

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

google/google.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,10 @@ func GetLoginURL(state string) string {
116116
return conf.AuthCodeURL(state)
117117
}
118118

119+
func WithLoginURL(url string) {
120+
loginURL = url
121+
}
122+
119123
// Auth is the google authorization middleware. You can use them to protect a routergroup.
120124
// Example:
121125
//

google/google_test.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,13 @@ func TestSetupFromString(t *testing.T) {
1717
assert.Equal(t, conf.ClientSecret, "clientsecret")
1818
})
1919
}
20+
21+
func TestWithLoginURL(t *testing.T) {
22+
t.Run("should assign the login url", func(t *testing.T) {
23+
loginURL = ""
24+
url := "http://fake.fake"
25+
WithLoginURL(url)
26+
assert.NotEmpty(t, url)
27+
assert.Equal(t, url, loginURL)
28+
})
29+
}

0 commit comments

Comments
 (0)