mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2026-04-15 01:41:56 +00:00
Add pull request closed event (#2684)
- [x] updates docs - [x] adjust UI - [x] show correct icon - [x] show correct link (to pr) - [x] add as option in secret edit - [x] parse webhook - [x] update tests - [x] github merged - [x] github closed - [x] gitea merged - [x] gitea closed - [x] bitbucket merged - [x] bitbucket closed - [x] gitlab merged - [x] gitlab closed closes #286
This commit is contained in:
@@ -79,23 +79,7 @@ func Test_parser(t *testing.T) {
|
||||
})
|
||||
|
||||
g.Describe("given a pull request hook", func() {
|
||||
g.It("should skip when action is not open or sync", func() {
|
||||
req := testHookRequest([]byte(fixtures.HookPullRequestInvalidAction), hookPull)
|
||||
p, r, b, err := parseHook(req, false)
|
||||
g.Assert(r).IsNil()
|
||||
g.Assert(b).IsNil()
|
||||
g.Assert(err).IsNil()
|
||||
g.Assert(p).IsNil()
|
||||
})
|
||||
g.It("should skip when state is not open", func() {
|
||||
req := testHookRequest([]byte(fixtures.HookPullRequestInvalidState), hookPull)
|
||||
p, r, b, err := parseHook(req, false)
|
||||
g.Assert(r).IsNil()
|
||||
g.Assert(b).IsNil()
|
||||
g.Assert(err).IsNil()
|
||||
g.Assert(p).IsNil()
|
||||
})
|
||||
g.It("should extract repository and pipeline details", func() {
|
||||
g.It("should handle a PR hook when PR got opened or pushed to", func() {
|
||||
req := testHookRequest([]byte(fixtures.HookPullRequest), hookPull)
|
||||
p, r, b, err := parseHook(req, false)
|
||||
g.Assert(err).IsNil()
|
||||
@@ -104,6 +88,24 @@ func Test_parser(t *testing.T) {
|
||||
g.Assert(p).IsNotNil()
|
||||
g.Assert(b.Event).Equal(model.EventPull)
|
||||
})
|
||||
g.It("should handle a PR closed hook when PR got closed", func() {
|
||||
req := testHookRequest([]byte(fixtures.HookPullRequestClosed), hookPull)
|
||||
p, r, b, err := parseHook(req, false)
|
||||
g.Assert(err).IsNil()
|
||||
g.Assert(r).IsNotNil()
|
||||
g.Assert(b).IsNotNil()
|
||||
g.Assert(p).IsNotNil()
|
||||
g.Assert(b.Event).Equal(model.EventPullClosed)
|
||||
})
|
||||
g.It("should handle a PR closed hook when PR got merged", func() {
|
||||
req := testHookRequest([]byte(fixtures.HookPullRequestMerged), hookPull)
|
||||
p, r, b, err := parseHook(req, false)
|
||||
g.Assert(err).IsNil()
|
||||
g.Assert(r).IsNotNil()
|
||||
g.Assert(b).IsNotNil()
|
||||
g.Assert(p).IsNotNil()
|
||||
g.Assert(b.Event).Equal(model.EventPullClosed)
|
||||
})
|
||||
})
|
||||
|
||||
g.Describe("given a deployment hook", func() {
|
||||
|
||||
Reference in New Issue
Block a user