-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add new suite of tests after dropping Goblin tests
Test that error conditions do not blow up the library. Since dropping the Goblin suite we did not test error handling.
- Loading branch information
Showing
2 changed files
with
121 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package kmsjwt_test | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/aws/aws-sdk-go-v2/service/kms" | ||
) | ||
|
||
type KMSStub struct { | ||
Err error | ||
PublicKey []byte | ||
} | ||
|
||
func (k KMSStub) GetPublicKey(context.Context, *kms.GetPublicKeyInput, ...func(*kms.Options)) (*kms.GetPublicKeyOutput, error) { | ||
return &kms.GetPublicKeyOutput{PublicKey: k.PublicKey}, k.Err | ||
} | ||
|
||
func (k KMSStub) Sign(context.Context, *kms.SignInput, ...func(*kms.Options)) (*kms.SignOutput, error) { | ||
// The message is already hashed, so we cannot produce a valid signature here. | ||
return &kms.SignOutput{Signature: []byte("invalid")}, k.Err | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters