Files
threshold/internal/bsr/options_test.go
shadowdaoandClaude Sonnet 5.5 962d708fdd Rename Go module paths to repo.anhonesthost.net/CyberCoveLLC/threshold
Rename root, api and sdk module paths (imports, go.mod, go_package,
ldflags, build scripts, buf configs) and regenerate protobuf/gateway
code with the project's pinned toolchain. Wire identifiers unchanged.
api gets a local replace for sdk; root/api/sdk require v0.1.0.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-12 10:33:41 -07:00

58 lines
1.4 KiB
Go

// Copyright IBM Corp. 2020, 2026
// SPDX-License-Identifier: BUSL-1.1
package bsr
import (
"context"
"testing"
"repo.anhonesthost.net/CyberCoveLLC/threshold/internal/bsr/kms"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func Test_GetOpts(t *testing.T) {
t.Parallel()
t.Run("default", func(t *testing.T) {
assert := assert.New(t)
opts := getOpts()
testOpts := options{
withSupportsMultiplex: false,
withKeys: nil,
withSha256Sum: nil,
}
assert.Equal(opts, testOpts)
})
t.Run("WithSupportsMultiplex", func(t *testing.T) {
assert := assert.New(t)
opts := getOpts(WithSupportsMultiplex(true))
testOpts := getDefaultOptions()
testOpts.withSupportsMultiplex = true
assert.Equal(opts, testOpts)
})
t.Run("WithKeys", func(t *testing.T) {
ctx := context.Background()
assert := assert.New(t)
require := require.New(t)
keys, err := kms.CreateKeys(ctx, kms.TestWrapper(t), "foo")
require.NoError(err)
opts := getOpts(WithKeys(keys))
testOpts := getDefaultOptions()
testOpts.withKeys = keys
assert.Equal(opts, testOpts)
})
t.Run("WithSha256Sum", func(t *testing.T) {
// echo "test" | sha256sum
sum := []byte(`f2ca1bb6c7e907d06dafe4687e579fce76b37e4e93b7605022da52e6ccc26fd2`)
assert := assert.New(t)
opts := getOpts(WithSha256Sum(sum))
testOpts := getDefaultOptions()
testOpts.withSha256Sum = sum
assert.Equal(opts, testOpts)
})
}