woodpecker/server/services/permissions/orgs_test.go
qwerty287 81b74025d4
Update Go imports paths (#4605)
Co-authored-by: Robert Kaussow <mail@thegeeklab.de>
2024-12-22 10:44:34 +01:00

20 lines
602 B
Go

package permissions
import (
"testing"
"github.com/stretchr/testify/assert"
"go.woodpecker-ci.org/woodpecker/v3/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"}}))
}