mirror of
https://github.com/wahyd4/loginsrv.git
synced 2026-08-09 04:46:29 +10:00
Fixed tests due to new grace period field with default
This commit is contained in:
@@ -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},
|
||||
|
||||
@@ -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{})
|
||||
|
||||
Reference in New Issue
Block a user