mirror of
https://github.com/pomerium/pomerium.git
synced 2025-05-10 23:57:34 +02:00
internal/config: pass urls by value
Signed-off-by: Bobby DeSimone <bobbydesimone@gmail.com>
This commit is contained in:
parent
62ceddef23
commit
2c1953b0ec
9 changed files with 45 additions and 40 deletions
|
@ -1,6 +1,7 @@
|
|||
package authenticate
|
||||
|
||||
import (
|
||||
"net/url"
|
||||
"testing"
|
||||
|
||||
"github.com/pomerium/pomerium/internal/config"
|
||||
|
@ -21,7 +22,7 @@ func newTestOptions(t *testing.T) *config.Options {
|
|||
func TestOptions_Validate(t *testing.T) {
|
||||
good := newTestOptions(t)
|
||||
badRedirectURL := newTestOptions(t)
|
||||
badRedirectURL.AuthenticateURL = nil
|
||||
badRedirectURL.AuthenticateURL = url.URL{}
|
||||
emptyClientID := newTestOptions(t)
|
||||
emptyClientID.ClientID = ""
|
||||
emptyClientSecret := newTestOptions(t)
|
||||
|
@ -35,7 +36,7 @@ func TestOptions_Validate(t *testing.T) {
|
|||
badSharedKey := newTestOptions(t)
|
||||
badSharedKey.SharedKey = ""
|
||||
badAuthenticateURL := newTestOptions(t)
|
||||
badAuthenticateURL.AuthenticateURL = nil
|
||||
badAuthenticateURL.AuthenticateURL = url.URL{}
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
|
@ -66,7 +67,13 @@ func TestNew(t *testing.T) {
|
|||
good := newTestOptions(t)
|
||||
|
||||
badRedirectURL := newTestOptions(t)
|
||||
badRedirectURL.AuthenticateURL = nil
|
||||
badRedirectURL.AuthenticateURL = url.URL{}
|
||||
|
||||
badCookieName := newTestOptions(t)
|
||||
badCookieName.CookieName = ""
|
||||
|
||||
badProvider := newTestOptions(t)
|
||||
badProvider.Provider = ""
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
|
@ -77,6 +84,8 @@ func TestNew(t *testing.T) {
|
|||
{"good", good, false},
|
||||
{"empty opts", &config.Options{}, true},
|
||||
{"fails to validate", badRedirectURL, true},
|
||||
{"bad cookie name", badCookieName, true},
|
||||
{"bad provider", badProvider, true},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue