mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-28 19:30:30 +00:00
f2071e3999
from #2855
17 lines
551 B
Go
17 lines
551 B
Go
package permissions
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
"go.woodpecker-ci.org/woodpecker/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"}))
|
|
}
|