summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/tools/blinkpy/w3c/pr_cleanup_tool_unittest.py
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2019-02-13 15:05:36 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2019-02-14 10:33:47 +0000
commite684a3455bcc29a6e3e66a004e352dea4e1141e7 (patch)
treed55b4003bde34d7d05f558f02cfd82b2a66a7aac /chromium/third_party/blink/tools/blinkpy/w3c/pr_cleanup_tool_unittest.py
parent2b94bfe47ccb6c08047959d1c26e392919550e86 (diff)
downloadqtwebengine-chromium-e684a3455bcc29a6e3e66a004e352dea4e1141e7.tar.gz
BASELINE: Update Chromium to 72.0.3626.110 and Ninja to 1.9.0
Change-Id: Ic57220b00ecc929a893c91f5cc552f5d3e99e922 Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'chromium/third_party/blink/tools/blinkpy/w3c/pr_cleanup_tool_unittest.py')
-rw-r--r--chromium/third_party/blink/tools/blinkpy/w3c/pr_cleanup_tool_unittest.py37
1 files changed, 35 insertions, 2 deletions
diff --git a/chromium/third_party/blink/tools/blinkpy/w3c/pr_cleanup_tool_unittest.py b/chromium/third_party/blink/tools/blinkpy/w3c/pr_cleanup_tool_unittest.py
index 164dfca8954..71abb16ac88 100644
--- a/chromium/third_party/blink/tools/blinkpy/w3c/pr_cleanup_tool_unittest.py
+++ b/chromium/third_party/blink/tools/blinkpy/w3c/pr_cleanup_tool_unittest.py
@@ -3,6 +3,7 @@ import json
from blinkpy.common.host_mock import MockHost
from blinkpy.common.system.log_testing import LoggingTestCase
+from blinkpy.common.path_finder import RELATIVE_WEB_TESTS
from blinkpy.w3c.gerrit_mock import MockGerritAPI, MockGerritCL
from blinkpy.w3c.pr_cleanup_tool import PrCleanupTool
from blinkpy.w3c.wpt_github import PullRequest
@@ -24,7 +25,7 @@ class PrCleanupToolTest(LoggingTestCase):
}))
self.host = host
- def test_main_successful_delete(self):
+ def test_main_successful_close_abandoned_cl(self):
pr_cleanup = PrCleanupTool(self.host)
pr_cleanup.wpt_github = MockWPTGitHub(pull_requests=[
PullRequest(title='title1', number=1234, body='Change-Id: 88', state='open', labels=[]),
@@ -48,4 +49,36 @@ class PrCleanupToolTest(LoggingTestCase):
self.assertEqual(pr_cleanup.gerrit.cls_queried, ['88'])
self.assertEqual(pr_cleanup.wpt_github.calls, [
'all_pull_requests',
- 'add_comment "Close this PR because the Chromium CL has been abandoned."', 'update_pr'])
+ 'add_comment "Close this PR because the Chromium CL has been abandoned."',
+ 'update_pr', 'get_pr_branch', 'delete_remote_branch'])
+
+ def test_main_successful_close_no_exportable_changes(self):
+ pr_cleanup = PrCleanupTool(self.host)
+ pr_cleanup.wpt_github = MockWPTGitHub(pull_requests=[
+ PullRequest(title='title1', number=1234, body='Change-Id: 99', state='open', labels=[]),
+ ])
+ pr_cleanup.gerrit = MockGerritAPI()
+ pr_cleanup.gerrit.cl = MockGerritCL(
+ data={
+ 'change_id': 'I001',
+ 'subject': 'subject',
+ '_number': 1234,
+ 'status': 'MERGED',
+ 'current_revision': '1',
+ 'has_review_started': True,
+ 'revisions': {
+ '1': {'commit_with_footers': 'a commit with footers',
+ 'files': {
+ RELATIVE_WEB_TESTS + 'foo/bar.html': '',
+ }}
+ },
+ 'owner': {'email': 'test@chromium.org'},
+ },
+ api=pr_cleanup.gerrit)
+ pr_cleanup.main(['--credentials-json', '/tmp/credentials.json'])
+ self.assertEqual(pr_cleanup.gerrit.cls_queried, ['99'])
+ self.assertEqual(pr_cleanup.wpt_github.calls, [
+ 'all_pull_requests',
+ 'add_comment "Close this PR because the Chromium'
+ ' CL does not have exportable changes."',
+ 'update_pr', 'get_pr_branch', 'delete_remote_branch'])