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

Unified Diff: tests/presubmit_unittest.py

Issue 6712007: Check for a missing scheme in the input_api.host. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools/
Patch Set: Created 9 years, 9 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
« presubmit_canned_checks.py ('K') | « 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
===================================================================
--- tests/presubmit_unittest.py (revision 78512)
+++ tests/presubmit_unittest.py (working copy)
@@ -1867,13 +1867,16 @@
def OwnersTest(self, is_committing, tbr=False, change_tags=None,
suggested_reviewers=None, approvers=None,
- uncovered_files=None, expected_reviewers=None, expected_output=''):
+ uncovered_files=None, expected_reviewers=None, expected_output='',
+ host_url=None):
affected_file = self.mox.CreateMock(presubmit.SvnAffectedFile)
affected_file.LocalPath().AndReturn('foo.cc')
change = self.mox.CreateMock(presubmit.Change)
change.AffectedFiles(None).AndReturn([affected_file])
input_api = self.MockInputApi(change, False)
+ if host_url:
+ input_api.host_url = host_url
fake_db = self.mox.CreateMock(owners.Database)
fake_db.email_regexp = input_api.re.compile(owners.BASIC_EMAIL_REGEXP)
input_api.owners_db = fake_db
@@ -1887,7 +1890,7 @@
rietveld_response = ('{"owner": "john@example.com",'
'"messages": [' + ','.join(messages) + ']}')
input_api.urllib2.urlopen(
- input_api.host_url + '/api/1?messages=true').AndReturn(
+ 'http://localhost/api/1?messages=true').AndReturn(
StringIO.StringIO(rietveld_response))
input_api.json = presubmit.json
fake_db.files_not_covered_by(set(['foo.cc']), approvers).AndReturn(
@@ -1937,6 +1940,12 @@
uncovered_files=set(),
expected_output='--tbr was specified, skipping OWNERS check\n')
+ def testCannedCheckOwners_MissingSchemeInHostURL(self):
+ self.OwnersTest(is_committing=True,
+ approvers=set(['ben@example.com']),
+ uncovered_files=set(), host_url='localhost')
+
+
if __name__ == '__main__':
import unittest
unittest.main()
« presubmit_canned_checks.py ('K') | « presubmit_canned_checks.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698