grafana/pkg/services/accesscontrol/roles_test.go

45 lines
594 B
Go
Raw Normal View History

package accesscontrol
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestConcatPermissions(t *testing.T) {
perms1 := []Permission{
{
Action: "test",
Scope: "test:*",
},
{
Action: "test1",
Scope: "test1:*",
},
}
perms2 := []Permission{
{
Action: "test1",
Scope: "*",
},
}
expected := []Permission{
{
Action: "test",
Scope: "test:*",
},
{
Action: "test1",
Scope: "test1:*",
},
{
Action: "test1",
Scope: "*",
},
}
perms := ConcatPermissions(perms1, perms2)
assert.ElementsMatch(t, perms, expected)
}