Files
threshold/internal/auth/oidc/managed_group_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

38 lines
1.2 KiB
Go

// Copyright IBM Corp. 2020, 2026
// SPDX-License-Identifier: BUSL-1.1
package oidc
import (
"context"
"testing"
"repo.anhonesthost.net/CyberCoveLLC/threshold/internal/errors"
"github.com/stretchr/testify/assert"
)
func Test_ManagedGroups_RepoValidate(t *testing.T) {
t.Parallel()
ctx := context.TODO()
assert := assert.New(t)
const op = "test"
mg := AllocManagedGroup()
t.Run("empty auth method", func(t *testing.T) {
assert.Contains(mg.validate(ctx, op).Error(), errors.New(ctx, errors.InvalidParameter, op, "missing auth method id").Error(), errors.WithoutEvent())
})
t.Run("empty filter", func(t *testing.T) {
mg.AuthMethodId = "amoidc_1234567890"
assert.Contains(mg.validate(ctx, op).Error(), errors.New(ctx, errors.InvalidParameter, op, "missing filter").Error(), errors.WithoutEvent())
})
t.Run("bad filter", func(t *testing.T) {
mg.AuthMethodId = "amoidc_1234567890"
mg.Filter = "foobar"
assert.Contains(mg.validate(ctx, op).Error(), errors.New(ctx, errors.InvalidParameter, op, "error evaluating filter expression").Error(), errors.WithoutEvent())
})
t.Run("valid", func(t *testing.T) {
mg.AuthMethodId = "amoidc_1234567890"
mg.Filter = TestFakeManagedGroupFilter
assert.NoError(mg.validate(ctx, op))
})
}