argo-cd/util/security/rbac_test.go
Michael Crenshaw 0fa3c3d67d
chore(lint): enable tparallel linter (#23318)
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2025-06-08 15:10:55 +02:00

54 lines
875 B
Go

package security
import (
"testing"
"github.com/stretchr/testify/assert"
)
func Test_AppRBACName(t *testing.T) {
t.Parallel()
testCases := []struct {
name string
defaultNS string
project string
namespace string
appName string
expectedResult string
}{
{
"namespace is empty",
"argocd",
"default",
"",
"app",
"default/app",
},
{
"namespace is default namespace",
"argocd",
"default",
"argocd",
"app",
"default/app",
},
{
"namespace is not default namespace",
"argocd",
"default",
"test",
"app",
"default/test/app",
},
}
for _, tc := range testCases {
tcc := tc
t.Run(tcc.name, func(t *testing.T) {
t.Parallel()
result := RBACName(tcc.defaultNS, tcc.project, tcc.namespace, tcc.appName)
assert.Equal(t, tcc.expectedResult, result)
})
}
}