mirror of https://github.com/grafana/grafana.git
45 lines
594 B
Go
45 lines
594 B
Go
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)
|
|
}
|