summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorFabien Boucher <fboucher@redhat.com>2019-09-05 09:55:52 +0200
committerFabien Boucher <fboucher@redhat.com>2019-09-18 11:49:12 +0200
commit3c2b5c6ed2dd772d4d9e11d291abdf7710356867 (patch)
tree0326b1d85428c9146d480616c134c07eab3a469b /tests
parent795520d28616b3756d4533856aa01d1cc8fa697e (diff)
downloadzuul-3c2b5c6ed2dd772d4d9e11d291abdf7710356867.tar.gz
Pagure - handle initial comment change event
The "initial comment" is the first comment of a PR on Pagure. It is used to provide the Depends-on stanza. Recently Pagure added the capability to send an event when that initial comment is changed: https://pagure.io/pagure/issue/4398 This change handles the event as a PR changed to retrigger the attached jobs. Change-Id: I62d4e783e94528126cd4a7d85b3e664e84758bf1
Diffstat (limited to 'tests')
-rw-r--r--tests/base.py6
-rw-r--r--tests/unit/test_pagure_driver.py5
2 files changed, 11 insertions, 0 deletions
diff --git a/tests/base.py b/tests/base.py
index 885a070d0..01b8da1ac 100644
--- a/tests/base.py
+++ b/tests/base.py
@@ -851,6 +851,7 @@ class FakePagurePullRequest(object):
'commit_start': self.commit_start,
'commit_stop': self.commit_stop,
'date_created': '0',
+ 'initial_comment': self.initial_comment,
'id': self.number,
'project': {
'fullname': self.project,
@@ -882,6 +883,11 @@ class FakePagurePullRequest(object):
self.addComment(message)
return self._getPullRequestEvent('pull-request.comment.added')
+ def getPullRequestInitialCommentEvent(self, message):
+ self.initial_comment = message
+ self._updateTimeStamp()
+ return self._getPullRequestEvent('pull-request.initial_comment.edited')
+
def getPullRequestStatusSetEvent(self, status):
self.addFlag(
status, "https://url", "Build %s" % status)
diff --git a/tests/unit/test_pagure_driver.py b/tests/unit/test_pagure_driver.py
index f0e8e121d..4643b8620 100644
--- a/tests/unit/test_pagure_driver.py
+++ b/tests/unit/test_pagure_driver.py
@@ -140,6 +140,11 @@ class TestPagureDriver(ZuulTestCase):
self.waitUntilSettled()
self.assertEqual(4, len(self.history))
+ self.fake_pagure.emitEvent(
+ A.getPullRequestInitialCommentEvent('Initial comment edited'))
+ self.waitUntilSettled()
+ self.assertEqual(6, len(self.history))
+
@simple_layout('layouts/basic-pagure.yaml', driver='pagure')
def test_pull_request_with_dyn_reconf(self):