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

Unified Diff: PRESUBMIT_test_mocks.py

Issue 966703003: Add PRESUBMIT tests for _CheckUserActionUpdate function. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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_test.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: PRESUBMIT_test_mocks.py
diff --git a/PRESUBMIT_test_mocks.py b/PRESUBMIT_test_mocks.py
index 03d9232cfa11c9317d630a01eb59e87b8b7cef3a..8e15d8cf53d37ee1c60c5d8c05d0ea819598426e 100644
--- a/PRESUBMIT_test_mocks.py
+++ b/PRESUBMIT_test_mocks.py
@@ -32,6 +32,9 @@ class MockInputApi(object):
def AffectedSourceFiles(self, file_filter=None):
return self.files
+ def LocalPaths(self):
+ return self.files
+
def PresubmitLocalPath(self):
return os.path.dirname(__file__)
@@ -62,22 +65,22 @@ class MockOutputApi(object):
return self.message
class PresubmitError(PresubmitResult):
- def __init__(self, message, items, long_text=''):
+ def __init__(self, message, items=None, long_text=''):
MockOutputApi.PresubmitResult.__init__(self, message, items, long_text)
self.type = 'error'
class PresubmitPromptWarning(PresubmitResult):
- def __init__(self, message, items, long_text=''):
+ def __init__(self, message, items=None, long_text=''):
MockOutputApi.PresubmitResult.__init__(self, message, items, long_text)
self.type = 'warning'
class PresubmitNotifyResult(PresubmitResult):
- def __init__(self, message, items, long_text=''):
+ def __init__(self, message, items=None, long_text=''):
MockOutputApi.PresubmitResult.__init__(self, message, items, long_text)
self.type = 'notify'
class PresubmitPromptOrNotify(PresubmitResult):
- def __init__(self, message, items, long_text=''):
+ def __init__(self, message, items=None, long_text=''):
MockOutputApi.PresubmitResult.__init__(self, message, items, long_text)
self.type = 'promptOrNotify'
@@ -103,6 +106,14 @@ class MockFile(object):
def LocalPath(self):
return self._local_path
+ def rfind(self, p):
+ """os.path.basename is called on MockFile so we need an rfind method."""
+ return self._local_path.rfind(p)
+
+ def __getitem__(self, i):
+ """os.path.basename is called on MockFile so we need a get method."""
+ return self._local_path[i]
+
class MockAffectedFile(MockFile):
def AbsoluteLocalPath(self):
« no previous file with comments | « PRESUBMIT_test.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698