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

Unified Diff: infra_libs/ts_mon/common/test/monitors_test.py

Issue 2127373005: Fix RetriableHttp (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Fix RetriableHttp Created 4 years, 5 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 | « infra_libs/ts_mon/common/monitors.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: infra_libs/ts_mon/common/test/monitors_test.py
diff --git a/infra_libs/ts_mon/common/test/monitors_test.py b/infra_libs/ts_mon/common/test/monitors_test.py
index 4f9ef6a7254c7450e40f0ba449c356e57292bcb5..fa05991983898d1fe9156429dd78714168cf6299 100644
--- a/infra_libs/ts_mon/common/test/monitors_test.py
+++ b/infra_libs/ts_mon/common/test/monitors_test.py
@@ -12,6 +12,7 @@ import unittest
from googleapiclient import errors
import mock
+from infra_libs import httplib2_utils
from infra_libs.ts_mon.common import interface
from infra_libs.ts_mon.common import monitors
from infra_libs.ts_mon.common import pb_to_popo
@@ -38,7 +39,7 @@ class HttpsMonitorTest(unittest.TestCase):
return json.dumps({'resource': pb_to_popo.convert(pb) })
def _test_send(self, http):
- mon = monitors.HttpsMonitor('endpoint', '/path/to/creds.p8.json', http=http)
+ mon = monitors.HttpsMonitor('endpoint', ':gce', http=http)
resp = mock.MagicMock(spec=httplib2.Response, status=200)
mon._http.request = mock.MagicMock(return_value=[resp, ""])
@@ -56,16 +57,15 @@ class HttpsMonitorTest(unittest.TestCase):
mock.call('endpoint', method='POST', body=self.message(collection)),
])
- @mock.patch('infra_libs.ts_mon.common.monitors.HttpsMonitor.'
- '_load_credentials', autospec=True)
- def test_default_send(self, _load_creds):
+ def test_default_send(self):
self._test_send(None)
- @mock.patch('infra_libs.ts_mon.common.monitors.HttpsMonitor.'
- '_load_credentials', autospec=True)
- def test_nondefault_send(self, _load_creds):
+ def test_http_send(self):
self._test_send(httplib2.Http())
+ def test_instrumented_http_send(self):
+ self._test_send(httplib2_utils.InstrumentedHttp('test'))
+
@mock.patch('infra_libs.ts_mon.common.monitors.HttpsMonitor.'
'_load_credentials', autospec=True)
def test_send_resp_failure(self, _load_creds):
« no previous file with comments | « infra_libs/ts_mon/common/monitors.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698