From 24735e38dbd76bac7b11093184ecc2b49112da5e Mon Sep 17 00:00:00 2001 From: Dino Omanovic Date: Fri, 26 May 2017 14:04:13 +0200 Subject: [PATCH] Fixed tests due to new grace period field with default --- caddy/setup_test.go | 5 +++++ login/config_test.go | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/caddy/setup_test.go b/caddy/setup_test.go index d75019a..080d4fc 100644 --- a/caddy/setup_test.go +++ b/caddy/setup_test.go @@ -39,6 +39,7 @@ func TestSetup(t *testing.T) { }, }, Oauth: login.Options{}, + GracePeriod: 5*time.Second, }}, { input: `login { @@ -73,6 +74,7 @@ func TestSetup(t *testing.T) { }, }, Oauth: login.Options{}, + GracePeriod: 5*time.Second, }}, { // backwards compatibility // * login path as argument @@ -96,6 +98,7 @@ func TestSetup(t *testing.T) { }, }, Oauth: login.Options{}, + GracePeriod: 5*time.Second, }}, { // backwards compatibility // * login path as argument @@ -119,6 +122,7 @@ func TestSetup(t *testing.T) { }, }, Oauth: login.Options{}, + GracePeriod: 5*time.Second, }}, // error cases @@ -140,6 +144,7 @@ func TestSetup(t *testing.T) { }, }, Oauth: login.Options{}, + GracePeriod: 5*time.Second, }}, {input: "login {\n}", shouldErr: true}, {input: "login xx yy {\n}", shouldErr: true}, diff --git a/login/config_test.go b/login/config_test.go index f22f1fc..ae26eed 100644 --- a/login/config_test.go +++ b/login/config_test.go @@ -38,6 +38,7 @@ func TestConfig_ReadConfig(t *testing.T) { "--backend=provider=simple", "--backend=provider=foo", "--github=client_id=foo,client_secret=bar", + "--grace-period=4s", } expected := &Config{ @@ -65,6 +66,7 @@ func TestConfig_ReadConfig(t *testing.T) { "client_secret": "bar", }, }, + GracePeriod: 4*time.Second, } cfg, err := readConfig(flag.NewFlagSet("", flag.ContinueOnError), input) @@ -89,6 +91,7 @@ func TestConfig_ReadConfigFromEnv(t *testing.T) { NoError(t, os.Setenv("LOGINSRV_COOKIE_HTTP_ONLY", "false")) NoError(t, os.Setenv("LOGINSRV_SIMPLE", "foo=bar")) NoError(t, os.Setenv("LOGINSRV_GITHUB", "client_id=foo,client_secret=bar")) + NoError(t, os.Setenv("LOGINSRV_GRACE_PERIOD", "4s")) expected := &Config{ Host: "host", @@ -116,6 +119,7 @@ func TestConfig_ReadConfigFromEnv(t *testing.T) { "client_secret": "bar", }, }, + GracePeriod: 4*time.Second, } cfg, err := readConfig(flag.NewFlagSet("", flag.ContinueOnError), []string{})