woodpecker/server/plugins/permissions/orgs_test.go
2023-12-27 10:36:49 +01:00

20 lines
602 B
Go

package permissions
import (
"testing"
"github.com/stretchr/testify/assert"
"go.woodpecker-ci.org/woodpecker/v2/server/model"
)
func TestOrgs(t *testing.T) {
o := NewOrgs([]string{"woodpecker-ci"})
assert.True(t, o.IsConfigured)
assert.True(t, o.IsMember([]*model.Team{{Login: "woodpecker-ci"}}))
assert.False(t, o.IsMember([]*model.Team{{Login: "not-woodpecker-ci"}}))
empty := NewOrgs([]string{})
assert.False(t, empty.IsConfigured)
assert.False(t, empty.IsMember([]*model.Team{{Login: "woodpecker-ci"}}))
assert.False(t, empty.IsMember([]*model.Team{{Login: "not-woodpecker-ci"}}))
}