Fixed tests due to new grace period field with default

This commit is contained in:
Dino Omanovic
2017-05-26 14:04:13 +02:00
parent 5007069277
commit 24735e38db
2 changed files with 9 additions and 0 deletions
+5
View File
@@ -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},
+4
View File
@@ -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{})