fix: add test

This commit is contained in:
Tore Stendal Lønøy 2023-12-08 12:02:35 +01:00
parent 2d7451b36a
commit a3e71a9f1c
No known key found for this signature in database

View file

@ -263,6 +263,35 @@ func TestGlobalExternalAlwaysSetCookie(t *testing.T) {
}
}
func TestGlobalExternalDefaultEnable(t *testing.T) {
testCases := map[string]struct {
defaultEnable string
result bool
}{
"true": {
defaultEnable: "true",
result: true,
},
"false": {
defaultEnable: "false",
result: false,
},
"set empty": {
defaultEnable: "",
},
"error": {
defaultEnable: "error string",
},
}
for n, tc := range testCases {
cfg := ReadConfig(map[string]string{"global-auth-default-enable": tc.defaultEnable})
if cfg.GlobalAuthDefaultEnable != tc.result {
t.Errorf("Testing %v. Expected \"%v\" but \"%v\" was returned", n, tc.result, cfg.GlobalAuthDefaultEnable)
}
}
}
func TestGlobalExternalAuthSigninRedirectParamParsing(t *testing.T) {
testCases := map[string]struct {
param string