Remove internal dependancy
This commit is contained in:
parent
7878b22b09
commit
a70452219b
1
Godeps
1
Godeps
|
@ -26,7 +26,6 @@ github.com/hashicorp/raft b95f335efee1992886864389183ebda0c0a5d0f6
|
||||||
github.com/hashicorp/raft-boltdb d1e82c1ec3f15ee991f7cc7ffd5b67ff6f5bbaee
|
github.com/hashicorp/raft-boltdb d1e82c1ec3f15ee991f7cc7ffd5b67ff6f5bbaee
|
||||||
github.com/influxdata/influxdb 0e0f85a0c1fd1788ae4f9145531b02c539cfa5b5
|
github.com/influxdata/influxdb 0e0f85a0c1fd1788ae4f9145531b02c539cfa5b5
|
||||||
github.com/influxdb/influxdb c1d6c14c47dfb4d60878a979fbdd8b526281d3d6
|
github.com/influxdb/influxdb c1d6c14c47dfb4d60878a979fbdd8b526281d3d6
|
||||||
github.com/influxdb/telegraf d3a5cca1bc18f315dacbd9941f1e4556fde86538
|
|
||||||
github.com/jmespath/go-jmespath c01cf91b011868172fdcd9f41838e80c9d716264
|
github.com/jmespath/go-jmespath c01cf91b011868172fdcd9f41838e80c9d716264
|
||||||
github.com/klauspost/crc32 999f3125931f6557b991b2f8472172bdfa578d38
|
github.com/klauspost/crc32 999f3125931f6557b991b2f8472172bdfa578d38
|
||||||
github.com/lib/pq 8ad2b298cadd691a77015666a5372eae5dbfac8f
|
github.com/lib/pq 8ad2b298cadd691a77015666a5372eae5dbfac8f
|
||||||
|
|
|
@ -10,7 +10,6 @@ import (
|
||||||
|
|
||||||
"github.com/gorilla/mux"
|
"github.com/gorilla/mux"
|
||||||
"github.com/influxdata/telegraf/plugins/inputs"
|
"github.com/influxdata/telegraf/plugins/inputs"
|
||||||
mod "github.com/influxdata/telegraf/plugins/inputs/github_webhooks/models"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
@ -23,7 +22,7 @@ type GithubWebhooks struct {
|
||||||
// Lock for the struct
|
// Lock for the struct
|
||||||
sync.Mutex
|
sync.Mutex
|
||||||
// Events buffer to store events between Gather calls
|
// Events buffer to store events between Gather calls
|
||||||
events []mod.Event
|
events []Event
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewGithubWebhooks() *GithubWebhooks {
|
func NewGithubWebhooks() *GithubWebhooks {
|
||||||
|
@ -51,7 +50,7 @@ func (gh *GithubWebhooks) Gather(acc inputs.Accumulator) error {
|
||||||
p := event.NewPoint()
|
p := event.NewPoint()
|
||||||
acc.AddFields(gh.MeasurementName, p.Fields(), p.Tags(), p.Time())
|
acc.AddFields(gh.MeasurementName, p.Fields(), p.Tags(), p.Time())
|
||||||
}
|
}
|
||||||
gh.events = make([]mod.Event, 0)
|
gh.events = make([]Event, 0)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,8 +90,8 @@ func (gh *GithubWebhooks) eventHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
w.WriteHeader(http.StatusOK)
|
w.WriteHeader(http.StatusOK)
|
||||||
}
|
}
|
||||||
|
|
||||||
func newCommitComment(data []byte) (mod.Event, error) {
|
func newCommitComment(data []byte) (Event, error) {
|
||||||
commitCommentStruct := mod.CommitCommentEvent{}
|
commitCommentStruct := CommitCommentEvent{}
|
||||||
err := json.Unmarshal(data, &commitCommentStruct)
|
err := json.Unmarshal(data, &commitCommentStruct)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -100,8 +99,8 @@ func newCommitComment(data []byte) (mod.Event, error) {
|
||||||
return commitCommentStruct, nil
|
return commitCommentStruct, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func newCreate(data []byte) (mod.Event, error) {
|
func newCreate(data []byte) (Event, error) {
|
||||||
createStruct := mod.CreateEvent{}
|
createStruct := CreateEvent{}
|
||||||
err := json.Unmarshal(data, &createStruct)
|
err := json.Unmarshal(data, &createStruct)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -109,8 +108,8 @@ func newCreate(data []byte) (mod.Event, error) {
|
||||||
return createStruct, nil
|
return createStruct, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func newDelete(data []byte) (mod.Event, error) {
|
func newDelete(data []byte) (Event, error) {
|
||||||
deleteStruct := mod.DeleteEvent{}
|
deleteStruct := DeleteEvent{}
|
||||||
err := json.Unmarshal(data, &deleteStruct)
|
err := json.Unmarshal(data, &deleteStruct)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -118,8 +117,8 @@ func newDelete(data []byte) (mod.Event, error) {
|
||||||
return deleteStruct, nil
|
return deleteStruct, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func newDeployment(data []byte) (mod.Event, error) {
|
func newDeployment(data []byte) (Event, error) {
|
||||||
deploymentStruct := mod.DeploymentEvent{}
|
deploymentStruct := DeploymentEvent{}
|
||||||
err := json.Unmarshal(data, &deploymentStruct)
|
err := json.Unmarshal(data, &deploymentStruct)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -127,8 +126,8 @@ func newDeployment(data []byte) (mod.Event, error) {
|
||||||
return deploymentStruct, nil
|
return deploymentStruct, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func newDeploymentStatus(data []byte) (mod.Event, error) {
|
func newDeploymentStatus(data []byte) (Event, error) {
|
||||||
deploymentStatusStruct := mod.DeploymentStatusEvent{}
|
deploymentStatusStruct := DeploymentStatusEvent{}
|
||||||
err := json.Unmarshal(data, &deploymentStatusStruct)
|
err := json.Unmarshal(data, &deploymentStatusStruct)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -136,8 +135,8 @@ func newDeploymentStatus(data []byte) (mod.Event, error) {
|
||||||
return deploymentStatusStruct, nil
|
return deploymentStatusStruct, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func newFork(data []byte) (mod.Event, error) {
|
func newFork(data []byte) (Event, error) {
|
||||||
forkStruct := mod.ForkEvent{}
|
forkStruct := ForkEvent{}
|
||||||
err := json.Unmarshal(data, &forkStruct)
|
err := json.Unmarshal(data, &forkStruct)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -145,8 +144,8 @@ func newFork(data []byte) (mod.Event, error) {
|
||||||
return forkStruct, nil
|
return forkStruct, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func newGollum(data []byte) (mod.Event, error) {
|
func newGollum(data []byte) (Event, error) {
|
||||||
gollumStruct := mod.GollumEvent{}
|
gollumStruct := GollumEvent{}
|
||||||
err := json.Unmarshal(data, &gollumStruct)
|
err := json.Unmarshal(data, &gollumStruct)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -154,8 +153,8 @@ func newGollum(data []byte) (mod.Event, error) {
|
||||||
return gollumStruct, nil
|
return gollumStruct, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func newIssueComment(data []byte) (mod.Event, error) {
|
func newIssueComment(data []byte) (Event, error) {
|
||||||
issueCommentStruct := mod.IssueCommentEvent{}
|
issueCommentStruct := IssueCommentEvent{}
|
||||||
err := json.Unmarshal(data, &issueCommentStruct)
|
err := json.Unmarshal(data, &issueCommentStruct)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -163,8 +162,8 @@ func newIssueComment(data []byte) (mod.Event, error) {
|
||||||
return issueCommentStruct, nil
|
return issueCommentStruct, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func newIssues(data []byte) (mod.Event, error) {
|
func newIssues(data []byte) (Event, error) {
|
||||||
issuesStruct := mod.IssuesEvent{}
|
issuesStruct := IssuesEvent{}
|
||||||
err := json.Unmarshal(data, &issuesStruct)
|
err := json.Unmarshal(data, &issuesStruct)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -172,8 +171,8 @@ func newIssues(data []byte) (mod.Event, error) {
|
||||||
return issuesStruct, nil
|
return issuesStruct, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func newMember(data []byte) (mod.Event, error) {
|
func newMember(data []byte) (Event, error) {
|
||||||
memberStruct := mod.MemberEvent{}
|
memberStruct := MemberEvent{}
|
||||||
err := json.Unmarshal(data, &memberStruct)
|
err := json.Unmarshal(data, &memberStruct)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -181,8 +180,8 @@ func newMember(data []byte) (mod.Event, error) {
|
||||||
return memberStruct, nil
|
return memberStruct, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func newMembership(data []byte) (mod.Event, error) {
|
func newMembership(data []byte) (Event, error) {
|
||||||
membershipStruct := mod.MembershipEvent{}
|
membershipStruct := MembershipEvent{}
|
||||||
err := json.Unmarshal(data, &membershipStruct)
|
err := json.Unmarshal(data, &membershipStruct)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -190,8 +189,8 @@ func newMembership(data []byte) (mod.Event, error) {
|
||||||
return membershipStruct, nil
|
return membershipStruct, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func newPageBuild(data []byte) (mod.Event, error) {
|
func newPageBuild(data []byte) (Event, error) {
|
||||||
pageBuildEvent := mod.PageBuildEvent{}
|
pageBuildEvent := PageBuildEvent{}
|
||||||
err := json.Unmarshal(data, &pageBuildEvent)
|
err := json.Unmarshal(data, &pageBuildEvent)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -199,8 +198,8 @@ func newPageBuild(data []byte) (mod.Event, error) {
|
||||||
return pageBuildEvent, nil
|
return pageBuildEvent, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func newPublic(data []byte) (mod.Event, error) {
|
func newPublic(data []byte) (Event, error) {
|
||||||
publicEvent := mod.PublicEvent{}
|
publicEvent := PublicEvent{}
|
||||||
err := json.Unmarshal(data, &publicEvent)
|
err := json.Unmarshal(data, &publicEvent)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -208,8 +207,8 @@ func newPublic(data []byte) (mod.Event, error) {
|
||||||
return publicEvent, nil
|
return publicEvent, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func newPullRequest(data []byte) (mod.Event, error) {
|
func newPullRequest(data []byte) (Event, error) {
|
||||||
pullRequestStruct := mod.PullRequestEvent{}
|
pullRequestStruct := PullRequestEvent{}
|
||||||
err := json.Unmarshal(data, &pullRequestStruct)
|
err := json.Unmarshal(data, &pullRequestStruct)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -217,8 +216,8 @@ func newPullRequest(data []byte) (mod.Event, error) {
|
||||||
return pullRequestStruct, nil
|
return pullRequestStruct, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func newPullRequestReviewComment(data []byte) (mod.Event, error) {
|
func newPullRequestReviewComment(data []byte) (Event, error) {
|
||||||
pullRequestReviewCommentStruct := mod.PullRequestReviewCommentEvent{}
|
pullRequestReviewCommentStruct := PullRequestReviewCommentEvent{}
|
||||||
err := json.Unmarshal(data, &pullRequestReviewCommentStruct)
|
err := json.Unmarshal(data, &pullRequestReviewCommentStruct)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -226,8 +225,8 @@ func newPullRequestReviewComment(data []byte) (mod.Event, error) {
|
||||||
return pullRequestReviewCommentStruct, nil
|
return pullRequestReviewCommentStruct, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func newPush(data []byte) (mod.Event, error) {
|
func newPush(data []byte) (Event, error) {
|
||||||
pushStruct := mod.PushEvent{}
|
pushStruct := PushEvent{}
|
||||||
err := json.Unmarshal(data, &pushStruct)
|
err := json.Unmarshal(data, &pushStruct)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -235,8 +234,8 @@ func newPush(data []byte) (mod.Event, error) {
|
||||||
return pushStruct, nil
|
return pushStruct, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func newRelease(data []byte) (mod.Event, error) {
|
func newRelease(data []byte) (Event, error) {
|
||||||
releaseStruct := mod.ReleaseEvent{}
|
releaseStruct := ReleaseEvent{}
|
||||||
err := json.Unmarshal(data, &releaseStruct)
|
err := json.Unmarshal(data, &releaseStruct)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -244,8 +243,8 @@ func newRelease(data []byte) (mod.Event, error) {
|
||||||
return releaseStruct, nil
|
return releaseStruct, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func newRepository(data []byte) (mod.Event, error) {
|
func newRepository(data []byte) (Event, error) {
|
||||||
repositoryStruct := mod.RepositoryEvent{}
|
repositoryStruct := RepositoryEvent{}
|
||||||
err := json.Unmarshal(data, &repositoryStruct)
|
err := json.Unmarshal(data, &repositoryStruct)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -253,8 +252,8 @@ func newRepository(data []byte) (mod.Event, error) {
|
||||||
return repositoryStruct, nil
|
return repositoryStruct, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func newStatus(data []byte) (mod.Event, error) {
|
func newStatus(data []byte) (Event, error) {
|
||||||
statusStruct := mod.StatusEvent{}
|
statusStruct := StatusEvent{}
|
||||||
err := json.Unmarshal(data, &statusStruct)
|
err := json.Unmarshal(data, &statusStruct)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -262,8 +261,8 @@ func newStatus(data []byte) (mod.Event, error) {
|
||||||
return statusStruct, nil
|
return statusStruct, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func newTeamAdd(data []byte) (mod.Event, error) {
|
func newTeamAdd(data []byte) (Event, error) {
|
||||||
teamAddStruct := mod.TeamAddEvent{}
|
teamAddStruct := TeamAddEvent{}
|
||||||
err := json.Unmarshal(data, &teamAddStruct)
|
err := json.Unmarshal(data, &teamAddStruct)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -271,8 +270,8 @@ func newTeamAdd(data []byte) (mod.Event, error) {
|
||||||
return teamAddStruct, nil
|
return teamAddStruct, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func newWatch(data []byte) (mod.Event, error) {
|
func newWatch(data []byte) (Event, error) {
|
||||||
watchStruct := mod.WatchEvent{}
|
watchStruct := WatchEvent{}
|
||||||
err := json.Unmarshal(data, &watchStruct)
|
err := json.Unmarshal(data, &watchStruct)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -288,7 +287,7 @@ func (e *newEventError) Error() string {
|
||||||
return e.s
|
return e.s
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewEvent(r []byte, t string) (mod.Event, error) {
|
func NewEvent(r []byte, t string) (Event, error) {
|
||||||
log.Printf("New %v event recieved", t)
|
log.Printf("New %v event recieved", t)
|
||||||
switch t {
|
switch t {
|
||||||
case "commit_comment":
|
case "commit_comment":
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package models
|
package github_webhooks
|
||||||
|
|
||||||
func CommitCommentEventJSON() string {
|
func CommitCommentEventJSON() string {
|
||||||
return `{
|
return `{
|
|
@ -1,4 +1,4 @@
|
||||||
package models
|
package github_webhooks
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
@ -8,7 +8,7 @@ import (
|
||||||
"github.com/influxdata/influxdb/client/v2"
|
"github.com/influxdata/influxdb/client/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
const meas = "ghWebhooks"
|
const meas = "github_webhooks"
|
||||||
|
|
||||||
type Event interface {
|
type Event interface {
|
||||||
NewPoint() *client.Point
|
NewPoint() *client.Point
|
|
@ -5,13 +5,11 @@ import (
|
||||||
"net/http/httptest"
|
"net/http/httptest"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
mod "github.com/influxdata/telegraf/plugins/inputs/github_webhooks/models"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestCommitCommentEvent(t *testing.T) {
|
func TestCommitCommentEvent(t *testing.T) {
|
||||||
gh := NewGithubWebhooks()
|
gh := NewGithubWebhooks()
|
||||||
jsonString := mod.CommitCommentEventJSON()
|
jsonString := CommitCommentEventJSON()
|
||||||
req, _ := http.NewRequest("POST", "/", strings.NewReader(jsonString))
|
req, _ := http.NewRequest("POST", "/", strings.NewReader(jsonString))
|
||||||
req.Header.Add("X-Github-Event", "commit_comment")
|
req.Header.Add("X-Github-Event", "commit_comment")
|
||||||
w := httptest.NewRecorder()
|
w := httptest.NewRecorder()
|
||||||
|
@ -23,7 +21,7 @@ func TestCommitCommentEvent(t *testing.T) {
|
||||||
|
|
||||||
func TestDeleteEvent(t *testing.T) {
|
func TestDeleteEvent(t *testing.T) {
|
||||||
gh := NewGithubWebhooks()
|
gh := NewGithubWebhooks()
|
||||||
jsonString := mod.DeleteEventJSON()
|
jsonString := DeleteEventJSON()
|
||||||
req, _ := http.NewRequest("POST", "/", strings.NewReader(jsonString))
|
req, _ := http.NewRequest("POST", "/", strings.NewReader(jsonString))
|
||||||
req.Header.Add("X-Github-Event", "delete")
|
req.Header.Add("X-Github-Event", "delete")
|
||||||
w := httptest.NewRecorder()
|
w := httptest.NewRecorder()
|
||||||
|
@ -35,7 +33,7 @@ func TestDeleteEvent(t *testing.T) {
|
||||||
|
|
||||||
func TestDeploymentEvent(t *testing.T) {
|
func TestDeploymentEvent(t *testing.T) {
|
||||||
gh := NewGithubWebhooks()
|
gh := NewGithubWebhooks()
|
||||||
jsonString := mod.DeploymentEventJSON()
|
jsonString := DeploymentEventJSON()
|
||||||
req, _ := http.NewRequest("POST", "/", strings.NewReader(jsonString))
|
req, _ := http.NewRequest("POST", "/", strings.NewReader(jsonString))
|
||||||
req.Header.Add("X-Github-Event", "deployment")
|
req.Header.Add("X-Github-Event", "deployment")
|
||||||
w := httptest.NewRecorder()
|
w := httptest.NewRecorder()
|
||||||
|
@ -47,7 +45,7 @@ func TestDeploymentEvent(t *testing.T) {
|
||||||
|
|
||||||
func TestDeploymentStatusEvent(t *testing.T) {
|
func TestDeploymentStatusEvent(t *testing.T) {
|
||||||
gh := NewGithubWebhooks()
|
gh := NewGithubWebhooks()
|
||||||
jsonString := mod.DeploymentStatusEventJSON()
|
jsonString := DeploymentStatusEventJSON()
|
||||||
req, _ := http.NewRequest("POST", "/", strings.NewReader(jsonString))
|
req, _ := http.NewRequest("POST", "/", strings.NewReader(jsonString))
|
||||||
req.Header.Add("X-Github-Event", "deployment_status")
|
req.Header.Add("X-Github-Event", "deployment_status")
|
||||||
w := httptest.NewRecorder()
|
w := httptest.NewRecorder()
|
||||||
|
@ -59,7 +57,7 @@ func TestDeploymentStatusEvent(t *testing.T) {
|
||||||
|
|
||||||
func TestForkEvent(t *testing.T) {
|
func TestForkEvent(t *testing.T) {
|
||||||
gh := NewGithubWebhooks()
|
gh := NewGithubWebhooks()
|
||||||
jsonString := mod.ForkEventJSON()
|
jsonString := ForkEventJSON()
|
||||||
req, _ := http.NewRequest("POST", "/", strings.NewReader(jsonString))
|
req, _ := http.NewRequest("POST", "/", strings.NewReader(jsonString))
|
||||||
req.Header.Add("X-Github-Event", "fork")
|
req.Header.Add("X-Github-Event", "fork")
|
||||||
w := httptest.NewRecorder()
|
w := httptest.NewRecorder()
|
||||||
|
@ -71,7 +69,7 @@ func TestForkEvent(t *testing.T) {
|
||||||
|
|
||||||
func TestGollumEvent(t *testing.T) {
|
func TestGollumEvent(t *testing.T) {
|
||||||
gh := NewGithubWebhooks()
|
gh := NewGithubWebhooks()
|
||||||
jsonString := mod.GollumEventJSON()
|
jsonString := GollumEventJSON()
|
||||||
req, _ := http.NewRequest("POST", "/", strings.NewReader(jsonString))
|
req, _ := http.NewRequest("POST", "/", strings.NewReader(jsonString))
|
||||||
req.Header.Add("X-Github-Event", "gollum")
|
req.Header.Add("X-Github-Event", "gollum")
|
||||||
w := httptest.NewRecorder()
|
w := httptest.NewRecorder()
|
||||||
|
@ -83,7 +81,7 @@ func TestGollumEvent(t *testing.T) {
|
||||||
|
|
||||||
func TestIssueCommentEvent(t *testing.T) {
|
func TestIssueCommentEvent(t *testing.T) {
|
||||||
gh := NewGithubWebhooks()
|
gh := NewGithubWebhooks()
|
||||||
jsonString := mod.IssueCommentEventJSON()
|
jsonString := IssueCommentEventJSON()
|
||||||
req, _ := http.NewRequest("POST", "/", strings.NewReader(jsonString))
|
req, _ := http.NewRequest("POST", "/", strings.NewReader(jsonString))
|
||||||
req.Header.Add("X-Github-Event", "issue_comment")
|
req.Header.Add("X-Github-Event", "issue_comment")
|
||||||
w := httptest.NewRecorder()
|
w := httptest.NewRecorder()
|
||||||
|
@ -95,7 +93,7 @@ func TestIssueCommentEvent(t *testing.T) {
|
||||||
|
|
||||||
func TestIssuesEvent(t *testing.T) {
|
func TestIssuesEvent(t *testing.T) {
|
||||||
gh := NewGithubWebhooks()
|
gh := NewGithubWebhooks()
|
||||||
jsonString := mod.IssuesEventJSON()
|
jsonString := IssuesEventJSON()
|
||||||
req, _ := http.NewRequest("POST", "/", strings.NewReader(jsonString))
|
req, _ := http.NewRequest("POST", "/", strings.NewReader(jsonString))
|
||||||
req.Header.Add("X-Github-Event", "issues")
|
req.Header.Add("X-Github-Event", "issues")
|
||||||
w := httptest.NewRecorder()
|
w := httptest.NewRecorder()
|
||||||
|
@ -107,7 +105,7 @@ func TestIssuesEvent(t *testing.T) {
|
||||||
|
|
||||||
func TestMemberEvent(t *testing.T) {
|
func TestMemberEvent(t *testing.T) {
|
||||||
gh := NewGithubWebhooks()
|
gh := NewGithubWebhooks()
|
||||||
jsonString := mod.MemberEventJSON()
|
jsonString := MemberEventJSON()
|
||||||
req, _ := http.NewRequest("POST", "/", strings.NewReader(jsonString))
|
req, _ := http.NewRequest("POST", "/", strings.NewReader(jsonString))
|
||||||
req.Header.Add("X-Github-Event", "member")
|
req.Header.Add("X-Github-Event", "member")
|
||||||
w := httptest.NewRecorder()
|
w := httptest.NewRecorder()
|
||||||
|
@ -119,7 +117,7 @@ func TestMemberEvent(t *testing.T) {
|
||||||
|
|
||||||
func TestMembershipEvent(t *testing.T) {
|
func TestMembershipEvent(t *testing.T) {
|
||||||
gh := NewGithubWebhooks()
|
gh := NewGithubWebhooks()
|
||||||
jsonString := mod.MembershipEventJSON()
|
jsonString := MembershipEventJSON()
|
||||||
req, _ := http.NewRequest("POST", "/", strings.NewReader(jsonString))
|
req, _ := http.NewRequest("POST", "/", strings.NewReader(jsonString))
|
||||||
req.Header.Add("X-Github-Event", "membership")
|
req.Header.Add("X-Github-Event", "membership")
|
||||||
w := httptest.NewRecorder()
|
w := httptest.NewRecorder()
|
||||||
|
@ -131,7 +129,7 @@ func TestMembershipEvent(t *testing.T) {
|
||||||
|
|
||||||
func TestPageBuildEvent(t *testing.T) {
|
func TestPageBuildEvent(t *testing.T) {
|
||||||
gh := NewGithubWebhooks()
|
gh := NewGithubWebhooks()
|
||||||
jsonString := mod.PageBuildEventJSON()
|
jsonString := PageBuildEventJSON()
|
||||||
req, _ := http.NewRequest("POST", "/", strings.NewReader(jsonString))
|
req, _ := http.NewRequest("POST", "/", strings.NewReader(jsonString))
|
||||||
req.Header.Add("X-Github-Event", "page_build")
|
req.Header.Add("X-Github-Event", "page_build")
|
||||||
w := httptest.NewRecorder()
|
w := httptest.NewRecorder()
|
||||||
|
@ -143,7 +141,7 @@ func TestPageBuildEvent(t *testing.T) {
|
||||||
|
|
||||||
func TestPublicEvent(t *testing.T) {
|
func TestPublicEvent(t *testing.T) {
|
||||||
gh := NewGithubWebhooks()
|
gh := NewGithubWebhooks()
|
||||||
jsonString := mod.PublicEventJSON()
|
jsonString := PublicEventJSON()
|
||||||
req, _ := http.NewRequest("POST", "/", strings.NewReader(jsonString))
|
req, _ := http.NewRequest("POST", "/", strings.NewReader(jsonString))
|
||||||
req.Header.Add("X-Github-Event", "public")
|
req.Header.Add("X-Github-Event", "public")
|
||||||
w := httptest.NewRecorder()
|
w := httptest.NewRecorder()
|
||||||
|
@ -155,7 +153,7 @@ func TestPublicEvent(t *testing.T) {
|
||||||
|
|
||||||
func TestPullRequestReviewCommentEvent(t *testing.T) {
|
func TestPullRequestReviewCommentEvent(t *testing.T) {
|
||||||
gh := NewGithubWebhooks()
|
gh := NewGithubWebhooks()
|
||||||
jsonString := mod.PullRequestReviewCommentEventJSON()
|
jsonString := PullRequestReviewCommentEventJSON()
|
||||||
req, _ := http.NewRequest("POST", "/", strings.NewReader(jsonString))
|
req, _ := http.NewRequest("POST", "/", strings.NewReader(jsonString))
|
||||||
req.Header.Add("X-Github-Event", "pull_request_review_comment")
|
req.Header.Add("X-Github-Event", "pull_request_review_comment")
|
||||||
w := httptest.NewRecorder()
|
w := httptest.NewRecorder()
|
||||||
|
@ -167,7 +165,7 @@ func TestPullRequestReviewCommentEvent(t *testing.T) {
|
||||||
|
|
||||||
func TestPushEvent(t *testing.T) {
|
func TestPushEvent(t *testing.T) {
|
||||||
gh := NewGithubWebhooks()
|
gh := NewGithubWebhooks()
|
||||||
jsonString := mod.PushEventJSON()
|
jsonString := PushEventJSON()
|
||||||
req, _ := http.NewRequest("POST", "/", strings.NewReader(jsonString))
|
req, _ := http.NewRequest("POST", "/", strings.NewReader(jsonString))
|
||||||
req.Header.Add("X-Github-Event", "push")
|
req.Header.Add("X-Github-Event", "push")
|
||||||
w := httptest.NewRecorder()
|
w := httptest.NewRecorder()
|
||||||
|
@ -179,7 +177,7 @@ func TestPushEvent(t *testing.T) {
|
||||||
|
|
||||||
func TestReleaseEvent(t *testing.T) {
|
func TestReleaseEvent(t *testing.T) {
|
||||||
gh := NewGithubWebhooks()
|
gh := NewGithubWebhooks()
|
||||||
jsonString := mod.ReleaseEventJSON()
|
jsonString := ReleaseEventJSON()
|
||||||
req, _ := http.NewRequest("POST", "/", strings.NewReader(jsonString))
|
req, _ := http.NewRequest("POST", "/", strings.NewReader(jsonString))
|
||||||
req.Header.Add("X-Github-Event", "release")
|
req.Header.Add("X-Github-Event", "release")
|
||||||
w := httptest.NewRecorder()
|
w := httptest.NewRecorder()
|
||||||
|
@ -191,7 +189,7 @@ func TestReleaseEvent(t *testing.T) {
|
||||||
|
|
||||||
func TestRepositoryEvent(t *testing.T) {
|
func TestRepositoryEvent(t *testing.T) {
|
||||||
gh := NewGithubWebhooks()
|
gh := NewGithubWebhooks()
|
||||||
jsonString := mod.RepositoryEventJSON()
|
jsonString := RepositoryEventJSON()
|
||||||
req, _ := http.NewRequest("POST", "/", strings.NewReader(jsonString))
|
req, _ := http.NewRequest("POST", "/", strings.NewReader(jsonString))
|
||||||
req.Header.Add("X-Github-Event", "repository")
|
req.Header.Add("X-Github-Event", "repository")
|
||||||
w := httptest.NewRecorder()
|
w := httptest.NewRecorder()
|
||||||
|
@ -204,7 +202,7 @@ func TestRepositoryEvent(t *testing.T) {
|
||||||
func TestStatusEvent(t *testing.T) {
|
func TestStatusEvent(t *testing.T) {
|
||||||
gh := NewGithubWebhooks()
|
gh := NewGithubWebhooks()
|
||||||
|
|
||||||
jsonString := mod.StatusEventJSON()
|
jsonString := StatusEventJSON()
|
||||||
req, _ := http.NewRequest("POST", "/", strings.NewReader(jsonString))
|
req, _ := http.NewRequest("POST", "/", strings.NewReader(jsonString))
|
||||||
req.Header.Add("X-Github-Event", "status")
|
req.Header.Add("X-Github-Event", "status")
|
||||||
w := httptest.NewRecorder()
|
w := httptest.NewRecorder()
|
||||||
|
@ -216,7 +214,7 @@ func TestStatusEvent(t *testing.T) {
|
||||||
|
|
||||||
func TestTeamAddEvent(t *testing.T) {
|
func TestTeamAddEvent(t *testing.T) {
|
||||||
gh := NewGithubWebhooks()
|
gh := NewGithubWebhooks()
|
||||||
jsonString := mod.TeamAddEventJSON()
|
jsonString := TeamAddEventJSON()
|
||||||
req, _ := http.NewRequest("POST", "/", strings.NewReader(jsonString))
|
req, _ := http.NewRequest("POST", "/", strings.NewReader(jsonString))
|
||||||
req.Header.Add("X-Github-Event", "team_add")
|
req.Header.Add("X-Github-Event", "team_add")
|
||||||
w := httptest.NewRecorder()
|
w := httptest.NewRecorder()
|
||||||
|
@ -228,7 +226,7 @@ func TestTeamAddEvent(t *testing.T) {
|
||||||
|
|
||||||
func TestWatchEvent(t *testing.T) {
|
func TestWatchEvent(t *testing.T) {
|
||||||
gh := NewGithubWebhooks()
|
gh := NewGithubWebhooks()
|
||||||
jsonString := mod.WatchEventJSON()
|
jsonString := WatchEventJSON()
|
||||||
req, _ := http.NewRequest("POST", "/", strings.NewReader(jsonString))
|
req, _ := http.NewRequest("POST", "/", strings.NewReader(jsonString))
|
||||||
req.Header.Add("X-Github-Event", "watch")
|
req.Header.Add("X-Github-Event", "watch")
|
||||||
w := httptest.NewRecorder()
|
w := httptest.NewRecorder()
|
||||||
|
|
Loading…
Reference in New Issue