Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(707)

Unified Diff: tests/presubmit_unittest.py

Issue 11348122: Add presubmit check to verify issue is not closed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « presubmit_canned_checks.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/presubmit_unittest.py
diff --git a/tests/presubmit_unittest.py b/tests/presubmit_unittest.py
index cf449dcc83fe0569926c41c6e786233c06cf901d..49f53869315ab2d0546bef6c5115882236eabf15 100755
--- a/tests/presubmit_unittest.py
+++ b/tests/presubmit_unittest.py
@@ -1507,6 +1507,7 @@ class CannedChecksUnittest(PresubmitTestsBase):
'CheckLongLines', 'CheckTreeIsOpen', 'PanProjectChecks',
'CheckLicense',
'CheckOwners',
+ 'CheckIssueNotClosed',
'CheckRietveldTryJobExecution',
'CheckSingletonInHeaders',
'CheckSvnModifiedDirectories',
@@ -2253,7 +2254,8 @@ class CannedChecksUnittest(PresubmitTestsBase):
if issue:
input_api.rietveld.get_issue_properties(
- int(input_api.change.issue), True).AndReturn(rietveld_response)
+ issue=int(input_api.change.issue), messages=True).AndReturn(
+ rietveld_response)
people.add(owner_email)
fake_db.directories_not_covered_by(set(['foo/xyz.cc']),
@@ -2394,6 +2396,24 @@ class CannedChecksUnittest(PresubmitTestsBase):
is_committing=False,
uncovered_dirs=set())
+ def CheckIssueClosedBase(self, closed):
+ input_api = self.MockInputApi(
+ presubmit.Change('', '', None, None, 1, 0, None), False)
+ input_api.rietveld.get_issue_properties(
+ issue=int(input_api.change.issue), messages=False).AndReturn(
+ {'closed': closed, 'issue': 1})
+ self.mox.ReplayAll()
+ return presubmit_canned_checks.CheckIssueNotClosed(
+ input_api, presubmit.OutputApi)
+
+ def testIssueOpen(self):
+ self.assertEqual([], self.CheckIssueClosedBase(False))
+
+ def testIssueClosed(self):
+ results = self.CheckIssueClosedBase(True)
+ self.assertEqual(len(results), 1)
+ self.assertTrue(results[0].fatal)
+
def testCannedRunUnitTests(self):
change = presubmit.Change(
'foo1', 'description1', self.fake_root_dir, None, 0, 0, None)
« no previous file with comments | « presubmit_canned_checks.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698