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

Unified Diff: tests/presubmit_unittest.py

Issue 12377023: Use author as determined from scm if we can not get it from rietveld (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: update w/ review feedback Created 7 years, 10 months 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 2357473684158636706071f86fdb25a75c945c56..a85d3625a0ca093bc2e50fdf93823f21b0584b96 100755
--- a/tests/presubmit_unittest.py
+++ b/tests/presubmit_unittest.py
@@ -2233,6 +2233,7 @@ class CannedChecksUnittest(PresubmitTestsBase):
change = self.mox.CreateMock(presubmit.Change)
change.issue = issue
+ change.author_email = 'john@example.com'
affected_file = self.mox.CreateMock(presubmit.SvnAffectedFile)
input_api = self.MockInputApi(change, False)
fake_db = self.mox.CreateMock(owners.Database)
@@ -2244,10 +2245,9 @@ class CannedChecksUnittest(PresubmitTestsBase):
if not is_committing or (not tbr and issue):
affected_file.LocalPath().AndReturn('foo/xyz.cc')
change.AffectedFiles(file_filter=None).AndReturn([affected_file])
- owner_email = 'john@example.com'
if not rietveld_response:
rietveld_response = {
- "owner_email": owner_email,
+ "owner_email": change.author_email,
"messages": [
{"sender": a, "text": "I approve", "approval": True}
for a in approvers
@@ -2264,17 +2264,18 @@ class CannedChecksUnittest(PresubmitTestsBase):
input_api.rietveld.get_issue_properties(
issue=int(input_api.change.issue), messages=True).AndReturn(
rietveld_response)
- people.add(owner_email)
if author_counts_as_owner:
+ people.add(change.author_email)
fake_db.files_not_covered_by(set(['foo/xyz.cc']),
people).AndReturn(uncovered_files)
else:
+ people.discard(change.author_email)
fake_db.files_not_covered_by(set(['foo/xyz.cc']),
- people.difference(set([owner_email]))).AndReturn(uncovered_files)
+ people).AndReturn(uncovered_files)
if not is_committing and uncovered_files:
fake_db.reviewers_for(set(['foo/xyz.cc']),
- owner_email if issue else '').AndReturn(owner_email)
+ change.author_email).AndReturn(change.author_email)
self.mox.ReplayAll()
output = presubmit.PresubmitOutput()
@@ -2367,9 +2368,7 @@ class CannedChecksUnittest(PresubmitTestsBase):
is_committing=False,
uncovered_files=set(['foo']),
expected_output='Missing OWNER reviewers for these files:\n'
- ' foo\n'
- 'Until the issue is uploaded, this list will include '
- 'files for which you are an OWNER.\n')
+ ' foo\n')
def testCannedCheckOwners_NoLGTM(self):
self.AssertOwnersWorks(expected_output='Missing LGTM from someone '
« 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