Files
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

54 lines
1.4 KiB
Go

// Copyright IBM Corp. 2020, 2026
// SPDX-License-Identifier: BUSL-1.1
package auth
import (
"testing"
"repo.anhonesthost.net/CyberCoveLLC/threshold/internal/kms"
"repo.anhonesthost.net/CyberCoveLLC/threshold/internal/perms"
"repo.anhonesthost.net/CyberCoveLLC/threshold/internal/types/action"
"github.com/stretchr/testify/assert"
)
// Test_GetOpts provides unit tests for GetOpts and all the options
func Test_GetOpts(t *testing.T) {
t.Parallel()
withKms := new(kms.Kms)
res := new(perms.Resource)
// test default values
defaultOpts := getDefaultOptions()
assert.Equal(t, options{}, defaultOpts)
opts := getOpts(
WithScopeId("foo"),
WithPin("bar"),
WithId("zip"),
WithAction(action.AddHosts),
WithUserId("user"),
WithKms(withKms),
WithRecoveryTokenNotAllowed(true),
WithAnonymousUserNotAllowed(true),
WithRecursive(true),
WithResource(res),
WithActions([]string{"callback"}),
)
exp := options{
withScopeId: "foo",
withPin: "bar",
withId: "zip",
withAction: action.AddHosts,
withUserId: "user",
withKms: withKms,
withRecoveryTokenNotAllowed: true,
withAnonymousUserNotAllowed: true,
withRecursive: true,
withResource: res,
withActions: []string{"callback"},
}
assert.Equal(t, exp, opts)
}