Add support for ping events
This commit is contained in:
@@ -59,6 +59,7 @@ func TestMain(m *testing.M) {
|
||||
OrganizationEvent,
|
||||
OrgBlockEvent,
|
||||
PageBuildEvent,
|
||||
PingEvent,
|
||||
ProjectCardEvent,
|
||||
ProjectColumnEvent,
|
||||
ProjectEvent,
|
||||
@@ -2742,6 +2743,48 @@ func TestPageBuildEvent(t *testing.T) {
|
||||
Equal(t, resp.StatusCode, http.StatusOK)
|
||||
}
|
||||
|
||||
func TestPingEvent(t *testing.T) {
|
||||
|
||||
payload := `{
|
||||
"zen": "Keep it logically awesome.",
|
||||
"hook_id": 20081052,
|
||||
"hook": {
|
||||
"type": "App",
|
||||
"id": 20081052,
|
||||
"name": "web",
|
||||
"active": true,
|
||||
"events": [
|
||||
"pull_request"
|
||||
],
|
||||
"config": {
|
||||
"content_type": "json",
|
||||
"insecure_ssl": "0",
|
||||
"secret": "********",
|
||||
"url": "https://ngrok.io/webhook"
|
||||
},
|
||||
"updated_at": "2018-01-15T10:48:54Z",
|
||||
"created_at": "2018-01-15T10:48:54Z",
|
||||
"app_id": 8157
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
req, err := http.NewRequest("POST", "http://127.0.0.1:3010/webhooks", bytes.NewBuffer([]byte(payload)))
|
||||
req.Header.Set("Content-Type", "application/json")
|
||||
req.Header.Set("X-Github-Event", "ping")
|
||||
req.Header.Set("X-Hub-Signature", "sha1=f82267eb5c6408d5986209da906747f57c11b33b")
|
||||
|
||||
Equal(t, err, nil)
|
||||
|
||||
client := &http.Client{}
|
||||
resp, err := client.Do(req)
|
||||
Equal(t, err, nil)
|
||||
|
||||
defer resp.Body.Close()
|
||||
|
||||
Equal(t, resp.StatusCode, http.StatusOK)
|
||||
}
|
||||
|
||||
func TestProjectCardEvent(t *testing.T) {
|
||||
|
||||
payload := `{
|
||||
|
||||
Reference in New Issue
Block a user