github.com/argoproj/argo-events@v1.9.1/eventsources/sources/gitlab/hook_util_test.go (about) 1 package gitlab 2 3 import ( 4 "testing" 5 6 "github.com/stretchr/testify/assert" 7 "github.com/xanzy/go-gitlab" 8 ) 9 10 func TestGetGroupHook(t *testing.T) { 11 hooks := []*gitlab.GroupHook{ 12 { 13 URL: "https://example0.com/", 14 }, 15 { 16 URL: "https://example1.com/", 17 }, 18 } 19 20 assert.Equal(t, hooks[1], getGroupHook(hooks, "https://example1.com/")) 21 assert.Nil(t, getGroupHook(hooks, "https://example.com/")) 22 } 23 24 func TestGetProjectHook(t *testing.T) { 25 hooks := []*gitlab.ProjectHook{ 26 { 27 URL: "https://example0.com/", 28 }, 29 { 30 URL: "https://example1.com/", 31 }, 32 } 33 34 assert.Equal(t, hooks[1], getProjectHook(hooks, "https://example1.com/")) 35 assert.Nil(t, getProjectHook(hooks, "https://example.com/")) 36 }