woodpecker/server/plugins/permissions/orgs_test.go

21 lines
602 B
Go
Raw Normal View History

2023-12-27 09:36:49 +00:00
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"}}))
}