Index: tests/presubmit_unittest.py |
diff --git a/tests/presubmit_unittest.py b/tests/presubmit_unittest.py |
index cf449dcc83fe0569926c41c6e786233c06cf901d..7b1d2591eb11cff03fee6bac607b89cfd55f58b7 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', |
@@ -2252,10 +2253,7 @@ class CannedChecksUnittest(PresubmitTestsBase): |
people = reviewers |
if issue: |
- input_api.rietveld.get_issue_properties( |
- int(input_api.change.issue), True).AndReturn(rietveld_response) |
people.add(owner_email) |
- |
fake_db.directories_not_covered_by(set(['foo/xyz.cc']), |
people).AndReturn(uncovered_dirs) |
if not is_committing and uncovered_dirs: |
@@ -2263,8 +2261,12 @@ class CannedChecksUnittest(PresubmitTestsBase): |
self.mox.ReplayAll() |
output = presubmit.PresubmitOutput() |
+ if issue: |
+ issue_props = rietveld_response |
+ else: |
+ issue_props = None |
results = presubmit_canned_checks.CheckOwners(input_api, |
- presubmit.OutputApi) |
+ presubmit.OutputApi, issue_props=issue_props) |
if results: |
results[0].handle(output) |
self.assertEquals(output.getvalue(), expected_output) |
@@ -2394,6 +2396,19 @@ class CannedChecksUnittest(PresubmitTestsBase): |
is_committing=False, |
uncovered_dirs=set()) |
+ def testIssueOpen(self): |
+ results = presubmit_canned_checks.CheckIssueNotClosed( |
+ {'closed': False, 'issue': 0}, |
+ presubmit.OutputApi) |
+ self.assertEqual([], results) |
+ |
+ def testIssueClosed(self): |
+ results = presubmit_canned_checks.CheckIssueNotClosed( |
+ {'closed': True, 'issue': 0}, |
+ presubmit.OutputApi) |
+ 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) |