* [COMPLIANCE] Update Copyright and License Headers * chore: make gen to generate files with copyright headers * chore: update missed copyright headers --------- Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com> Co-authored-by: Justin Nguyen <justin.nguyen@hashicorp.com>
53 lines
1.4 KiB
Go
53 lines
1.4 KiB
Go
// Copyright IBM Corp. 2020, 2025
|
|
// SPDX-License-Identifier: BUSL-1.1
|
|
|
|
package iam
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/hashicorp/boundary/internal/types/action"
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
// Test_CrudActions provides unit tests for CrudActions()
|
|
func Test_CrudActions(t *testing.T) {
|
|
t.Parallel()
|
|
t.Run("valid", func(t *testing.T) {
|
|
assert := assert.New(t)
|
|
a := CrudlActions()
|
|
assert.Equal(a[action.Create.String()], action.Create)
|
|
assert.Equal(a[action.Update.String()], action.Update)
|
|
assert.Equal(a[action.Read.String()], action.Read)
|
|
assert.Equal(a[action.Delete.String()], action.Delete)
|
|
})
|
|
t.Run("invalid", func(t *testing.T) {
|
|
assert := assert.New(t)
|
|
a := CrudlActions()
|
|
aType, ok := a["invalid"]
|
|
assert.Equal(ok, false)
|
|
assert.Equal(aType, action.Unknown)
|
|
})
|
|
}
|
|
|
|
// Test_CrudlActions provides unit tests for CrudlActions()
|
|
func Test_CrudlActions(t *testing.T) {
|
|
t.Parallel()
|
|
t.Run("valid", func(t *testing.T) {
|
|
assert := assert.New(t)
|
|
a := CrudlActions()
|
|
assert.Equal(a[action.List.String()], action.List)
|
|
assert.Equal(a[action.Create.String()], action.Create)
|
|
assert.Equal(a[action.Update.String()], action.Update)
|
|
assert.Equal(a[action.Read.String()], action.Read)
|
|
assert.Equal(a[action.Delete.String()], action.Delete)
|
|
})
|
|
t.Run("invalid", func(t *testing.T) {
|
|
assert := assert.New(t)
|
|
a := CrudlActions()
|
|
aType, ok := a["invalid"]
|
|
assert.Equal(ok, false)
|
|
assert.Equal(aType, action.Unknown)
|
|
})
|
|
}
|