Skip to content
Permalink
Browse files

♻️ Refactor BFT to read events from files

  • Loading branch information...
webknjaz committed Mar 11, 2019
1 parent c89a60f commit 3c3066cec63ef9ab3462c9feb7c7fdf925eb8bdb
Showing with 57 additions and 75 deletions.
  1. +22 −0 check_run_event.json
  2. +5 −0 ping_event.json
  3. +16 −0 pull_request_event.json
  4. +14 −75 test_bot.sh
@@ -0,0 +1,22 @@
{
"check_run": {
"conclusion": "",
"name": "",
"check_suite": {
"id": 0,
"pull_requests": [
{
"number": 1,
"head": {
"ref": "feature/github-app-aiohttp",
"sha": "f2114ef"
}
}
]
}
},
"requested_action": {"identifier": 0},
"action": "rerequested",
"installation": {"id": 491111},
"repository": {"full_name": "sanitizers/browntruck"}
}
@@ -0,0 +1,5 @@
{
"hook": {"app_id": 0},
"hook_id": 0,
"zen": "Hey zen!"
}
@@ -0,0 +1,16 @@
{
"action": "synchronize",
"sender": {"login": "curl"},
"number": 2,
"installation": {"id": 491111},
"repository": {"full_name": "sanitizers/browntruck"},
"pull_request": {
"number": 2,
"head": {
"ref": "feature/github-app-aiohttp",
"sha": "713a1820272569204d70eb28bfbf997e2a3bd121"
},
"diff_url":
"https://patch-diff.githubusercontent.com/raw/sanitizers/browntruck/pull/2.diff"
}
}
@@ -6,79 +6,18 @@ GITHUB_APP_WEBHOOKS_URL=http://localhost:8080
>&2 echo ====================================================================
>&2 echo

>&2 echo Testing ping...
curl \
-H 'X-GitHub-Event:ping' \
-H 'X-GitHub-Delivery:cxxx-Ping-delivery' \
-H 'Content-Type:application/json' \
--data-raw '
{
"hook": {"app_id": 0},
"hook_id": 0,
"zen": "Hey zen!"
}
' "${GITHUB_APP_WEBHOOKS_URL}"
>&2 echo
>&2 echo

sleep 2
for event in ping pull_request check_run
do
GITHUB_EVENT_PATH="`pwd`/${event}_event.json"
>&2 echo Testing "${event}"...
curl \
-H "X-GitHub-Event:${event}" \
-H "X-GitHub-Delivery:cxxx-${event}-delivery" \
-H 'Content-Type:application/json' \
--data "@${GITHUB_EVENT_PATH}" \
"${GITHUB_APP_WEBHOOKS_URL}"
>&2 echo
>&2 echo

>&2 echo Testing pull_request...
curl \
-H 'X-GitHub-Event:pull_request' \
-H 'X-GitHub-Delivery:cxxx-PR-delivery' \
-H 'Content-Type:application/json' \
--data-raw '
{
"action": "synchronize",
"sender": {"login": "curl"},
"number": 2,
"installation": {"id": 491111},
"repository": {"full_name": "sanitizers/browntruck"},
"pull_request": {
"number": 2,
"head": {
"ref": "feature/github-app-aiohttp",
"sha": "713a1820272569204d70eb28bfbf997e2a3bd121"
},
"diff_url":
"https://patch-diff.githubusercontent.com/raw/sanitizers/browntruck/pull/2.diff"
}
}
' "${GITHUB_APP_WEBHOOKS_URL}"
>&2 echo
>&2 echo

sleep 2

>&2 echo Testing check_run...
curl \
-H 'X-GitHub-Event:check_run' \
-H 'X-GitHub-Delivery:cxxx-Check-Run-delivery' \
-H 'Content-Type:application/json' \
--data-raw '
{
"check_run": {
"conclusion": "",
"name": "",
"check_suite": {
"id": 0,
"pull_requests": [
{
"number": 1,
"head": {
"ref": "feature/github-app-aiohttp",
"sha": "f2114ef"
}
}
]
}
},
"requested_action": {"identifier": 0},
"action": "rerequested",
"installation": {"id": 491111},
"repository": {"full_name": "sanitizers/browntruck"}
}
' "${GITHUB_APP_WEBHOOKS_URL}"
>&2 echo
>&2 echo
sleep 2
done

0 comments on commit 3c3066c

Please sign in to comment.
You can’t perform that action at this time.