diff options
author | Niall Sheridan <nsheridan@gmail.com> | 2017-02-11 20:20:35 +0000 |
---|---|---|
committer | Niall Sheridan <nsheridan@gmail.com> | 2017-02-11 20:20:35 +0000 |
commit | 9c344a0a95c44ef9cebade7b8a65ac160d9eb900 (patch) | |
tree | aa3782547656b26a55527295c78aa0b8621f8676 /server/auth/google/google_test.go | |
parent | 376b8f670a9c80e8ae69581a354cb989571c44c2 (diff) |
Revert "Remove the oauth_callback_url config option"
Diffstat (limited to 'server/auth/google/google_test.go')
-rw-r--r-- | server/auth/google/google_test.go | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/server/auth/google/google_test.go b/server/auth/google/google_test.go index 4d6191b..b3d2633 100644 --- a/server/auth/google/google_test.go +++ b/server/auth/google/google_test.go @@ -2,7 +2,6 @@ package google import ( "fmt" - "net/http" "testing" "github.com/nsheridan/cashier/server/config" @@ -23,6 +22,7 @@ func TestNew(t *testing.T) { a.NoError(err) a.Equal(p.config.ClientID, oauthClientID) a.Equal(p.config.ClientSecret, oauthClientSecret) + a.Equal(p.config.RedirectURL, oauthCallbackURL) a.Equal(p.domain, domain) a.Equal(p.whitelist, map[string]bool{"user": true}) } @@ -31,6 +31,7 @@ func TestWhitelist(t *testing.T) { c := &config.Auth{ OauthClientID: oauthClientID, OauthClientSecret: oauthClientSecret, + OauthCallbackURL: oauthCallbackURL, ProviderOpts: map[string]string{"domain": ""}, UsersWhitelist: []string{}, } @@ -55,10 +56,7 @@ func TestStartSession(t *testing.T) { p, err := newGoogle() a.NoError(err) - r := &http.Request{ - Host: oauthCallbackURL, - } - s := p.StartSession("test_state", r) + s := p.StartSession("test_state") a.Contains(s.AuthURL, "accounts.google.com/o/oauth2/auth") a.Contains(s.AuthURL, "state=test_state") a.Contains(s.AuthURL, fmt.Sprintf("hd=%s", domain)) @@ -69,6 +67,7 @@ func newGoogle() (*Config, error) { c := &config.Auth{ OauthClientID: oauthClientID, OauthClientSecret: oauthClientSecret, + OauthCallbackURL: oauthCallbackURL, ProviderOpts: map[string]string{"domain": domain}, UsersWhitelist: users, } |