Documentation ¶
Overview ¶
Package testutil provides utilities that are intended to enable easier and more concise writing of unit test code.
Index ¶
- type MockKeyManagementServer
- func (s *MockKeyManagementServer) AsymmetricSign(ctx context.Context, req *kmspb.AsymmetricSignRequest) (*kmspb.AsymmetricSignResponse, error)
- func (s *MockKeyManagementServer) CreateCryptoKeyVersion(ctx context.Context, req *kmspb.CreateCryptoKeyVersionRequest) (*kmspb.CryptoKeyVersion, error)
- func (s *MockKeyManagementServer) DestroyCryptoKeyVersion(ctx context.Context, req *kmspb.DestroyCryptoKeyVersionRequest) (*kmspb.CryptoKeyVersion, error)
- func (s *MockKeyManagementServer) GetCryptoKey(ctx context.Context, req *kmspb.GetCryptoKeyRequest) (*kmspb.CryptoKey, error)
- func (s *MockKeyManagementServer) GetCryptoKeyVersion(ctx context.Context, req *kmspb.GetCryptoKeyVersionRequest) (*kmspb.CryptoKeyVersion, error)
- func (s *MockKeyManagementServer) GetPublicKey(ctx context.Context, req *kmspb.GetPublicKeyRequest) (*kmspb.PublicKey, error)
- func (s *MockKeyManagementServer) ListCryptoKeyVersions(ctx context.Context, req *kmspb.ListCryptoKeyVersionsRequest) (*kmspb.ListCryptoKeyVersionsResponse, error)
- func (s *MockKeyManagementServer) UpdateCryptoKey(ctx context.Context, req *kmspb.UpdateCryptoKeyRequest) (*kmspb.CryptoKey, error)
- func (s *MockKeyManagementServer) UpdateCryptoKeyVersion(ctx context.Context, req *kmspb.UpdateCryptoKeyVersionRequest) (*kmspb.CryptoKeyVersion, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MockKeyManagementServer ¶
type MockKeyManagementServer struct { // Embed for forward compatibility. // Tests will keep working if more methods are added // in the future. kmspb.UnimplementedKeyManagementServiceServer Reqs []proto.Message // If set, all calls return this error. Err error // responses to return if err == nil Resps []proto.Message Labels map[string]string PrivateKey *ecdsa.PrivateKey PublicKey string KeyName string VersionName string NumVersions int // contains filtered or unexported fields }
func NewMockKeyManagementServer ¶
func NewMockKeyManagementServer(keyName, versionName, primary string) *MockKeyManagementServer
NewMockKeyManagementServer sets up a mock KMS server with required values for use in testing.
func (*MockKeyManagementServer) AsymmetricSign ¶
func (s *MockKeyManagementServer) AsymmetricSign(ctx context.Context, req *kmspb.AsymmetricSignRequest) (*kmspb.AsymmetricSignResponse, error)
func (*MockKeyManagementServer) CreateCryptoKeyVersion ¶
func (s *MockKeyManagementServer) CreateCryptoKeyVersion(ctx context.Context, req *kmspb.CreateCryptoKeyVersionRequest) (*kmspb.CryptoKeyVersion, error)
func (*MockKeyManagementServer) DestroyCryptoKeyVersion ¶
func (s *MockKeyManagementServer) DestroyCryptoKeyVersion(ctx context.Context, req *kmspb.DestroyCryptoKeyVersionRequest) (*kmspb.CryptoKeyVersion, error)
func (*MockKeyManagementServer) GetCryptoKey ¶
func (s *MockKeyManagementServer) GetCryptoKey(ctx context.Context, req *kmspb.GetCryptoKeyRequest) (*kmspb.CryptoKey, error)
func (*MockKeyManagementServer) GetCryptoKeyVersion ¶
func (s *MockKeyManagementServer) GetCryptoKeyVersion(ctx context.Context, req *kmspb.GetCryptoKeyVersionRequest) (*kmspb.CryptoKeyVersion, error)
func (*MockKeyManagementServer) GetPublicKey ¶
func (s *MockKeyManagementServer) GetPublicKey(ctx context.Context, req *kmspb.GetPublicKeyRequest) (*kmspb.PublicKey, error)
func (*MockKeyManagementServer) ListCryptoKeyVersions ¶
func (s *MockKeyManagementServer) ListCryptoKeyVersions(ctx context.Context, req *kmspb.ListCryptoKeyVersionsRequest) (*kmspb.ListCryptoKeyVersionsResponse, error)
func (*MockKeyManagementServer) UpdateCryptoKey ¶
func (s *MockKeyManagementServer) UpdateCryptoKey(ctx context.Context, req *kmspb.UpdateCryptoKeyRequest) (*kmspb.CryptoKey, error)
func (*MockKeyManagementServer) UpdateCryptoKeyVersion ¶
func (s *MockKeyManagementServer) UpdateCryptoKeyVersion(ctx context.Context, req *kmspb.UpdateCryptoKeyVersionRequest) (*kmspb.CryptoKeyVersion, error)
Click to show internal directories.
Click to hide internal directories.