config: fix url type regression (#253)

Signed-off-by: Bobby DeSimone <bobbydesimone@gmail.com>
This commit is contained in:
Bobby DeSimone 2019-08-03 11:32:30 -07:00
parent 790619ef01
commit a962877ad4
No known key found for this signature in database
GPG key ID: AEE4CF12FE86D07E
12 changed files with 117 additions and 57 deletions

View file

@ -1,7 +1,6 @@
package authenticate
import (
"net/url"
"testing"
"github.com/pomerium/pomerium/internal/config"
@ -22,7 +21,9 @@ func newTestOptions(t *testing.T) *config.Options {
func TestOptions_Validate(t *testing.T) {
good := newTestOptions(t)
badRedirectURL := newTestOptions(t)
badRedirectURL.AuthenticateURL = url.URL{}
badRedirectURL.AuthenticateURL = nil
badScheme := newTestOptions(t)
badScheme.AuthenticateURL.Scheme = ""
emptyClientID := newTestOptions(t)
emptyClientID.ClientID = ""
emptyClientSecret := newTestOptions(t)
@ -36,7 +37,7 @@ func TestOptions_Validate(t *testing.T) {
badSharedKey := newTestOptions(t)
badSharedKey.SharedKey = ""
badAuthenticateURL := newTestOptions(t)
badAuthenticateURL.AuthenticateURL = url.URL{}
badAuthenticateURL.AuthenticateURL = nil
tests := []struct {
name string
@ -46,6 +47,7 @@ func TestOptions_Validate(t *testing.T) {
{"minimum options", good, false},
{"nil options", &config.Options{}, true},
{"bad redirect url", badRedirectURL, true},
{"bad scheme", badScheme, true},
{"no cookie secret", emptyCookieSecret, true},
{"invalid cookie secret", invalidCookieSecret, true},
{"short cookie secret", shortCookieLength, true},
@ -67,7 +69,7 @@ func TestNew(t *testing.T) {
good := newTestOptions(t)
badRedirectURL := newTestOptions(t)
badRedirectURL.AuthenticateURL = url.URL{}
badRedirectURL.AuthenticateURL = nil
badCookieName := newTestOptions(t)
badCookieName.CookieName = ""