Skip to content

Commit

Permalink
Add some more testing code
Browse files Browse the repository at this point in the history
  • Loading branch information
jefferai committed Mar 15, 2022
1 parent fdb9069 commit 8d9992b
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,16 @@ type TestInitFinalizerHmacComputer struct {
*TestInitFinalizer
}

type TestInitFinalizerHmacComputerKeyByter struct {
*TestInitFinalizerHmacComputer
}

var (
_ Wrapper = (*TestWrapper)(nil)
_ InitFinalizer = (*TestInitFinalizer)(nil)
_ InitFinalizer = (*TestInitFinalizerHmacComputer)(nil)
_ HmacComputer = (*TestInitFinalizerHmacComputer)(nil)
_ KeyBytes = (*TestInitFinalizerHmacComputerKeyByter)(nil)
)

// NewTestWrapper constructs a test wrapper
Expand Down Expand Up @@ -64,6 +69,21 @@ func NewTestInitFinalizerHmacComputer(secret []byte) *TestInitFinalizerHmacCompu
}
}

// NewTestInitFinalizerHmacComputerKeyByter constructs a test wrapper
func NewTestInitFinalizerHmacComputerKeyByter(secret []byte) *TestInitFinalizerHmacComputerKeyByter {
return &TestInitFinalizerHmacComputerKeyByter{
TestInitFinalizerHmacComputer: &TestInitFinalizerHmacComputer{
TestInitFinalizer: &TestInitFinalizer{
TestWrapper: &TestWrapper{
wrapperType: WrapperTypeTest,
secret: secret,
keyId: "static-key",
},
},
},
}
}

// NewTestWrapper constructs a test wrapper
func NewTestEnvelopeWrapper(secret []byte) *TestWrapper {
return &TestWrapper{
Expand All @@ -74,6 +94,11 @@ func NewTestEnvelopeWrapper(secret []byte) *TestWrapper {
}
}

// KeyBytes returns the key bytes
func (t *TestInitFinalizerHmacComputerKeyByter) KeyBytes(_ context.Context) ([]byte, error) {
return t.secret, nil
}

// HmacKeyId returns the HMAC key id
func (t *TestInitFinalizerHmacComputer) HmacKeyId(_ context.Context) (string, error) {
return "hmac-key", nil
Expand Down

0 comments on commit 8d9992b

Please sign in to comment.