aboutsummaryrefslogtreecommitdiff
path: root/server/auth/gitlab/gitlab_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'server/auth/gitlab/gitlab_test.go')
-rw-r--r--server/auth/gitlab/gitlab_test.go13
1 files changed, 9 insertions, 4 deletions
diff --git a/server/auth/gitlab/gitlab_test.go b/server/auth/gitlab/gitlab_test.go
index 39c2701..676cda2 100644
--- a/server/auth/gitlab/gitlab_test.go
+++ b/server/auth/gitlab/gitlab_test.go
@@ -2,6 +2,7 @@ package gitlab
import (
"fmt"
+ "net/http"
"testing"
"github.com/nsheridan/cashier/server/auth"
@@ -25,7 +26,6 @@ func TestNew(t *testing.T) {
g := p.(*Config)
a.Equal(g.config.ClientID, oauthClientID)
a.Equal(g.config.ClientSecret, oauthClientSecret)
- a.Equal(g.config.RedirectURL, oauthCallbackURL)
}
func TestNewBrokenSiteURL(t *testing.T) {
@@ -55,7 +55,10 @@ func TestGoodAllUsers(t *testing.T) {
a := assert.New(t)
p, _ := newGitlab()
- s := p.StartSession("test_state")
+ r := &http.Request{
+ Host: oauthCallbackURL,
+ }
+ s := p.StartSession("test_state", r)
a.Contains(s.AuthURL, "exampleorg/oauth/authorize")
a.Contains(s.AuthURL, "state=test_state")
a.Contains(s.AuthURL, fmt.Sprintf("client_id=%s", oauthClientID))
@@ -77,7 +80,10 @@ func TestStartSession(t *testing.T) {
a := assert.New(t)
p, _ := newGitlab()
- s := p.StartSession("test_state")
+ r := &http.Request{
+ Host: oauthCallbackURL,
+ }
+ s := p.StartSession("test_state", r)
a.Contains(s.AuthURL, "exampleorg/oauth/authorize")
a.Contains(s.AuthURL, "state=test_state")
a.Contains(s.AuthURL, fmt.Sprintf("client_id=%s", oauthClientID))
@@ -87,7 +93,6 @@ func newGitlab() (auth.Provider, error) {
c := &config.Auth{
OauthClientID: oauthClientID,
OauthClientSecret: oauthClientSecret,
- OauthCallbackURL: oauthCallbackURL,
ProviderOpts: map[string]string{
"group": group,
"siteurl": siteurl,