Add trigger capability on github pr review
A github pull request review is a new type of event that happens when
user provides a review of a pull request
https://developer.github.com/v3/pulls/reviews
It will create an event
https://developer.github.com/v3/activity/events/types/#pullrequestreviewevent
sent to the webhook. Allow filtering on submitted or dismissed actions
and the state of the review of approved, comment, or request_changes.
Signed-off-by: Jesse Keating <omgjlk@us.ibm.com>
Change-Id: If94c2fe8adbe18fa7f426d5462559ba24963424c
diff --git a/tests/unit/test_github_driver.py b/tests/unit/test_github_driver.py
index a1a05e0..f2a6e5b 100644
--- a/tests/unit/test_github_driver.py
+++ b/tests/unit/test_github_driver.py
@@ -177,6 +177,21 @@
self.assertEqual(2, len(self.history))
self.assertEqual(['other label'], C.labels)
+ @simple_layout('layouts/reviews-github.yaml', driver='github')
+ def test_review_event(self):
+ A = self.fake_github.openFakePullRequest('org/project', 'master', 'A')
+ self.fake_github.emitEvent(A.getReviewAddedEvent('approve'))
+ self.waitUntilSettled()
+ self.assertEqual(1, len(self.history))
+ self.assertEqual('project-reviews', self.history[0].name)
+ self.assertEqual(['tests passed'], A.labels)
+
+ # test_review_unmatched_event
+ B = self.fake_github.openFakePullRequest('org/project', 'master', 'B')
+ self.fake_github.emitEvent(B.getReviewAddedEvent('comment'))
+ self.waitUntilSettled()
+ self.assertEqual(1, len(self.history))
+
@simple_layout('layouts/dequeue-github.yaml', driver='github')
def test_dequeue_pull_synchronized(self):
self.executor_server.hold_jobs_in_build = True