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

Unified Diff: appengine/findit/crash/test/crash_testcase.py

Issue 2432203003: [Predator] Run predator. (Closed)
Patch Set: Fix nits. Created 4 years, 1 month 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 | « appengine/findit/crash/findit.py ('k') | appengine/findit/handlers/crash/crash_handler.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/findit/crash/test/crash_testcase.py
diff --git a/appengine/findit/crash/test/crash_testcase.py b/appengine/findit/crash/test/crash_testcase.py
index e8ac6cd60c18652ea043407bb4df3e3f5843c5e9..0dccd1eff2abfa47bd4c30b5d6a6b27f839f73b5 100644
--- a/appengine/findit/crash/test/crash_testcase.py
+++ b/appengine/findit/crash/test/crash_testcase.py
@@ -8,6 +8,7 @@ import re
from google.appengine.api import users
from common.findit_testcase import FinditTestCase
+from common import retry_http_client
from lib.gitiles.change_log import ChangeLog
from model.crash.crash_config import CrashConfig
@@ -81,12 +82,33 @@ DUMMY_CHANGELOG = ChangeLog.FromDict({
})
+class MockHttpClient(retry_http_client.RetryHttpClient): # pragma: no cover.
+
+ def __init__(self):
+ super(MockHttpClient, self).__init__()
+
+ def _Get(self, url, *_):
+ pass
+
+ def _Post(self, *_):
+ pass
+
+ def _Put(self, *_):
+ pass
+
+
class CrashTestCase(FinditTestCase): # pragma: no cover.
def setUp(self):
super(CrashTestCase, self).setUp()
CrashConfig.Get().Update(
users.User(email='admin@chromium.org'), True, **DEFAULT_CONFIG_DATA)
+ # A fake repository, needed by the Findit constructor. We should never
+ # go over the wire (e.g., in the call to ScheduleNewAnalysis below),
+ # and this helps ensure that.
stgao 2016/11/14 21:34:12 what's this for?
Sharu Jiang 2016/11/15 02:21:47 This was accidentally pasted... deleted in followi
def GetDummyChangeLog(self):
return DUMMY_CHANGELOG
+
+ def GetMockHttpClient(self):
+ return MockHttpClient()
stgao 2016/11/14 21:34:12 Why not just use a unittest.mock.Mock object?
Sharu Jiang 2016/11/15 02:21:47 I think it's better that MockHttpClient is a insta
stgao 2016/11/17 05:03:05 Why it is better? What's the benefit? Why a unitte
« no previous file with comments | « appengine/findit/crash/findit.py ('k') | appengine/findit/handlers/crash/crash_handler.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698