2023-12-27 09:36:49 +00:00
|
|
|
package permissions
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
|
2024-12-22 09:44:34 +00:00
|
|
|
"go.woodpecker-ci.org/woodpecker/v3/server/model"
|
2023-12-27 09:36:49 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
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"}}))
|
|
|
|
}
|