Files
threshold/sdk/pbs/controller/api/testing.go
T
Johan Brandhorst-Satzkorn 7f9b294a7e refact(all): Use testing.TB for test helpers
Our test helper packages were not possible to use
with benchmarks. This refactor switches to testing.TB
to allow both tests and benchmarks to use the helpers.
2022-04-29 16:33:44 -04:00

24 lines
628 B
Go

package api
import (
"reflect"
"testing"
"github.com/hashicorp/eventlogger/filters/encrypt"
wrapping "github.com/hashicorp/go-kms-wrapping/v2"
"google.golang.org/protobuf/types/known/fieldmaskpb"
)
// NewEncryptFilter is a copy of event.NewEncryptFilter since importing it would
// case circular deps. The primary reason for this test func is to make sure
// the proper IgnoreTypes are included for testing.
func NewEncryptFilter(t testing.TB, w wrapping.Wrapper) *encrypt.Filter {
t.Helper()
return &encrypt.Filter{
Wrapper: w,
IgnoreTypes: []reflect.Type{
reflect.TypeOf(&fieldmaskpb.FieldMask{}),
},
}
}