refactor and add access types
This commit is contained in:
parent
be6737328c
commit
42099c8207
12 changed files with 250 additions and 77 deletions
|
@ -2,6 +2,8 @@ package op
|
|||
|
||||
import "testing"
|
||||
|
||||
import "os"
|
||||
|
||||
func TestValidateIssuer(t *testing.T) {
|
||||
type args struct {
|
||||
issuer string
|
||||
|
@ -54,7 +56,7 @@ func TestValidateIssuer(t *testing.T) {
|
|||
{
|
||||
"localhost with http ok",
|
||||
args{"http://localhost:9999"},
|
||||
false,
|
||||
true,
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
|
@ -65,3 +67,28 @@ func TestValidateIssuer(t *testing.T) {
|
|||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidateIssuerDevLocalAllowed(t *testing.T) {
|
||||
type args struct {
|
||||
issuer string
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
wantErr bool
|
||||
}{
|
||||
{
|
||||
"localhost with http ok",
|
||||
args{"http://localhost:9999"},
|
||||
false,
|
||||
},
|
||||
}
|
||||
os.Setenv("CAOS_OIDC_DEV", "")
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
if err := ValidateIssuer(tt.args.issuer); (err != nil) != tt.wantErr {
|
||||
t.Errorf("ValidateIssuer() error = %v, wantErr %v", err, tt.wantErr)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue