photoprism/internal/acl/grants_test.go

21 lines
509 B
Go
Raw Permalink Normal View History

package acl
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestACL_Grants(t *testing.T) {
t.Run("RoleAdmin", func(t *testing.T) {
result := Resources.Grants(RoleAdmin)
assert.True(t, result[ResourcePhotos][ActionManage])
assert.True(t, result[ResourceConfig][ActionManage])
})
t.Run("RoleVisitor", func(t *testing.T) {
result := Resources.Grants(RoleVisitor)
assert.False(t, result[ResourcePhotos][ActionUpdate])
assert.False(t, result[ResourceConfig][ActionManage])
})
}