mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-26 20:01:02 +00:00
b9f6f3f9fb
`gci` seems to be much more strict.
18 lines
555 B
Go
18 lines
555 B
Go
package permissions
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
"go.woodpecker-ci.org/woodpecker/v2/server/model"
|
|
)
|
|
|
|
func TestOwnersAllowlist(t *testing.T) {
|
|
ol := NewOwnersAllowlist([]string{"woodpecker-ci"})
|
|
assert.True(t, ol.IsAllowed(&model.Repo{Owner: "woodpecker-ci"}))
|
|
assert.False(t, ol.IsAllowed(&model.Repo{Owner: "not-woodpecker-ci"}))
|
|
empty := NewOwnersAllowlist([]string{})
|
|
assert.True(t, empty.IsAllowed(&model.Repo{Owner: "woodpecker-ci"}))
|
|
assert.True(t, empty.IsAllowed(&model.Repo{Owner: "not-woodpecker-ci"}))
|
|
}
|