Fix unit tests.

This commit is contained in:
Mariano Cano 2020-05-19 17:45:15 -07:00
parent 5b680b2349
commit 82fb96588e
2 changed files with 3 additions and 2 deletions

View file

@ -13,7 +13,7 @@ func TestOptions_Validate(t *testing.T) {
{"nil", nil, false}, {"nil", nil, false},
{"softkms", &Options{Type: "softkms"}, false}, {"softkms", &Options{Type: "softkms"}, false},
{"cloudkms", &Options{Type: "cloudkms"}, false}, {"cloudkms", &Options{Type: "cloudkms"}, false},
{"awskms", &Options{Type: "awskms"}, true}, {"awskms", &Options{Type: "awskms"}, false},
{"pkcs11", &Options{Type: "pkcs11"}, true}, {"pkcs11", &Options{Type: "pkcs11"}, true},
{"unsupported", &Options{Type: "unsupported"}, true}, {"unsupported", &Options{Type: "unsupported"}, true},
} }

View file

@ -7,6 +7,7 @@ import (
"testing" "testing"
"github.com/smallstep/certificates/kms/apiv1" "github.com/smallstep/certificates/kms/apiv1"
"github.com/smallstep/certificates/kms/awskms"
"github.com/smallstep/certificates/kms/cloudkms" "github.com/smallstep/certificates/kms/cloudkms"
"github.com/smallstep/certificates/kms/softkms" "github.com/smallstep/certificates/kms/softkms"
) )
@ -27,8 +28,8 @@ func TestNew(t *testing.T) {
}{ }{
{"softkms", false, args{ctx, apiv1.Options{Type: "softkms"}}, &softkms.SoftKMS{}, false}, {"softkms", false, args{ctx, apiv1.Options{Type: "softkms"}}, &softkms.SoftKMS{}, false},
{"default", false, args{ctx, apiv1.Options{}}, &softkms.SoftKMS{}, false}, {"default", false, args{ctx, apiv1.Options{}}, &softkms.SoftKMS{}, false},
{"awskms", false, args{ctx, apiv1.Options{Type: "awskms"}}, &awskms.KMS{}, false},
{"cloudkms", true, args{ctx, apiv1.Options{Type: "cloudkms"}}, &cloudkms.CloudKMS{}, true}, // fails because not credentials {"cloudkms", true, args{ctx, apiv1.Options{Type: "cloudkms"}}, &cloudkms.CloudKMS{}, true}, // fails because not credentials
{"awskms", false, args{ctx, apiv1.Options{Type: "awskms"}}, nil, true}, // not yet supported
{"pkcs11", false, args{ctx, apiv1.Options{Type: "pkcs11"}}, nil, true}, // not yet supported {"pkcs11", false, args{ctx, apiv1.Options{Type: "pkcs11"}}, nil, true}, // not yet supported
{"fail validation", false, args{ctx, apiv1.Options{Type: "foobar"}}, nil, true}, {"fail validation", false, args{ctx, apiv1.Options{Type: "foobar"}}, nil, true},
} }