mirror of
https://github.com/pomerium/pomerium.git
synced 2025-06-24 13:38:17 +02:00
config: fix url type regression (#253)
Signed-off-by: Bobby DeSimone <bobbydesimone@gmail.com>
This commit is contained in:
parent
790619ef01
commit
a962877ad4
12 changed files with 117 additions and 57 deletions
|
@ -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 = ""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue