Fix tests.

This commit is contained in:
Mariano Cano 2019-03-13 16:46:12 -07:00
parent 0b4cde1ad3
commit 945a1371f1
2 changed files with 10 additions and 1 deletions

View file

@ -52,9 +52,17 @@ func TestJWK_Init(t *testing.T) {
err error err error
} }
tests := map[string]func(*testing.T) ProvisionerValidateTest{ tests := map[string]func(*testing.T) ProvisionerValidateTest{
"fail-empty-name": func(t *testing.T) ProvisionerValidateTest { "fail-empty": func(t *testing.T) ProvisionerValidateTest {
return ProvisionerValidateTest{ return ProvisionerValidateTest{
p: &JWK{}, p: &JWK{},
err: errors.New("provisioner type cannot be empty"),
}
},
"fail-empty-name": func(t *testing.T) ProvisionerValidateTest {
return ProvisionerValidateTest{
p: &JWK{
Type: "JWK",
},
err: errors.New("provisioner name cannot be empty"), err: errors.New("provisioner name cannot be empty"),
} }
}, },

View file

@ -84,6 +84,7 @@ func TestOIDC_Init(t *testing.T) {
{"ok", fields{"oidc", "name", "client-id", srv.URL + "/openid-configuration", nil, nil}, args{config}, false}, {"ok", fields{"oidc", "name", "client-id", srv.URL + "/openid-configuration", nil, nil}, args{config}, false},
{"ok-admins", fields{"oidc", "name", "client-id", srv.URL + "/openid-configuration", nil, []string{"foo@smallstep.com"}}, args{config}, false}, {"ok-admins", fields{"oidc", "name", "client-id", srv.URL + "/openid-configuration", nil, []string{"foo@smallstep.com"}}, args{config}, false},
{"no-name", fields{"oidc", "", "client-id", srv.URL + "/openid-configuration", nil, nil}, args{config}, true}, {"no-name", fields{"oidc", "", "client-id", srv.URL + "/openid-configuration", nil, nil}, args{config}, true},
{"no-type", fields{"", "name", "client-id", srv.URL + "/openid-configuration", nil, nil}, args{config}, true},
{"no-client-id", fields{"oidc", "name", "", srv.URL + "/openid-configuration", nil, nil}, args{config}, true}, {"no-client-id", fields{"oidc", "name", "", srv.URL + "/openid-configuration", nil, nil}, args{config}, true},
{"no-configuration", fields{"oidc", "name", "client-id", "", nil, nil}, args{config}, true}, {"no-configuration", fields{"oidc", "name", "client-id", "", nil, nil}, args{config}, true},
{"bad-configuration", fields{"oidc", "name", "client-id", srv.URL, nil, nil}, args{config}, true}, {"bad-configuration", fields{"oidc", "name", "client-id", srv.URL, nil, nil}, args{config}, true},