Skip to content
This repository has been archived by the owner on Aug 25, 2023. It is now read-only.

Commit

Permalink
chore: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
skynet2 committed Mar 22, 2023
1 parent cbcc576 commit 8f2dc35
Showing 1 changed file with 0 additions and 32 deletions.
32 changes: 0 additions & 32 deletions pkg/aws/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,6 @@ func TestCreate(t *testing.T) {

svc := New(awsConfig, metric, "", WithAWSClient(client))

//svc.client = &mockAWSClient{createKeyFunc: func(ctx context.Context, params *kms.CreateKeyInput,
// optFns ...func(*kms.Options)) (*kms.CreateKeyOutput, error) {
// return &kms.CreateKeyOutput{KeyMetadata: &types.KeyMetadata{KeyId: &keyID}}, nil
//}}

result, _, err := svc.Create(arieskms.ECDSAP256DER)
require.NoError(t, err)
require.Contains(t, result, keyID)
Expand Down Expand Up @@ -212,20 +207,6 @@ func TestCreateAndPubKeyBytes(t *testing.T) {
Return(&kms.CreateKeyOutput{KeyMetadata: &types.KeyMetadata{KeyId: &keyID}}, nil)
svc := New(&awsConfig, metric, "", WithAWSClient(client))

//svc.client = &mockAWSClient{
// getPublicKeyFunc: func(ctx context.Context, params *kms.GetPublicKeyInput,
// optFns ...func(*kms.Options)) (*kms.GetPublicKeyOutput, error) {
// return &kms.GetPublicKeyOutput{
// PublicKey: []byte("publickey"),
// SigningAlgorithms: []types.SigningAlgorithmSpec{types.SigningAlgorithmSpecEcdsaSha256},
// }, nil
// },
// createKeyFunc: func(ctx context.Context, params *kms.CreateKeyInput,
// optFns ...func(*kms.Options)) (*kms.CreateKeyOutput, error) {
// return &kms.CreateKeyOutput{KeyMetadata: &types.KeyMetadata{KeyId: &keyID}}, nil
// },
//}

keyID, publicKey, err := svc.CreateAndExportPubKeyBytes(arieskms.ECDSAP256DER)
require.NoError(t, err)
require.Contains(t, string(publicKey), "publickey")
Expand Down Expand Up @@ -264,14 +245,6 @@ func TestPubKeyBytes(t *testing.T) {
}, nil)
svc := New(awsConfig, metric, "", WithAWSClient(client))

//svc.client = &mockAWSClient{getPublicKeyFunc: func(ctx context.Context, params *kms.GetPublicKeyInput,
// optFns ...func(*kms.Options)) (*kms.GetPublicKeyOutput, error) {
// return &kms.GetPublicKeyOutput{
// PublicKey: []byte("publickey"),
// SigningAlgorithms: []types.SigningAlgorithmSpec{types.SigningAlgorithmSpecEcdsaSha256},
// }, nil
//}}

keyID, keyType, err := svc.ExportPubKeyBytes(
"aws-kms://arn:aws:kms:ca-central-1:111122223333:key/800d5768-3fd7-4edd-a4b8-4c81c3e4c147")
require.NoError(t, err)
Expand All @@ -289,11 +262,6 @@ func TestPubKeyBytes(t *testing.T) {
Return(nil, fmt.Errorf("failed to export public key"))
svc := New(awsConfig, metric, "", WithAWSClient(client))

//svc.client = &mockAWSClient{getPublicKeyFunc: func(ctx context.Context, params *kms.GetPublicKeyInput,
// optFns ...func(*kms.Options)) (*kms.GetPublicKeyOutput, error) {
// return nil, fmt.Errorf("failed to export public key")
//}}

_, _, err := svc.ExportPubKeyBytes(
"aws-kms://arn:aws:kms:ca-central-1:111122223333:key/800d5768-3fd7-4edd-a4b8-4c81c3e4c147")
require.Error(t, err)
Expand Down

0 comments on commit 8f2dc35

Please sign in to comment.