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

Side by Side Diff: dashboard/dashboard/start_try_job_test.py

Issue 3013753002: [pinpoint] Increase Gitiles service timeout. (Closed)
Patch Set: Dashboard unit tests. Created 3 years, 3 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 unified diff | Download patch
« no previous file with comments | « dashboard/dashboard/services/gitiles_service_test.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import base64 5 import base64
6 import httplib2 6 import httplib2
7 import json 7 import json
8 import unittest 8 import unittest
9 9
10 import mock 10 import mock
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 239
240 # Workaround git try issue, see crbug.com/257689""" 240 # Workaround git try issue, see crbug.com/257689"""
241 # pylint: enable=line-too-long 241 # pylint: enable=line-too-long
242 242
243 # These globals are set in tests and checked in _MockMakeRequest. 243 # These globals are set in tests and checked in _MockMakeRequest.
244 _EXPECTED_CONFIG_DIFF = None 244 _EXPECTED_CONFIG_DIFF = None
245 _TEST_EXPECTED_BOT = None 245 _TEST_EXPECTED_BOT = None
246 _TEST_EXPECTED_CONFIG_CONTENTS = None 246 _TEST_EXPECTED_CONFIG_CONTENTS = None
247 247
248 248
249 def _MockFetch(url=None): 249 def _MockFetch(url=None, deadline=None):
250 del deadline
250 if start_try_job._BISECT_CONFIG_PATH in url: 251 if start_try_job._BISECT_CONFIG_PATH in url:
251 return testing_common.FakeResponseObject( 252 return testing_common.FakeResponseObject(
252 200, base64.encodestring(_BISECT_CONFIG_CONTENTS)) 253 200, base64.encodestring(_BISECT_CONFIG_CONTENTS))
253 elif start_try_job._PERF_CONFIG_PATH in url: 254 elif start_try_job._PERF_CONFIG_PATH in url:
254 return testing_common.FakeResponseObject( 255 return testing_common.FakeResponseObject(
255 200, base64.encodestring(_PERF_CONFIG_CONTENTS)) 256 200, base64.encodestring(_PERF_CONFIG_CONTENTS))
256 257
257 258
258 def _MockFailedFetch(url=None): # pylint: disable=unused-argument 259 def _MockFailedFetch(url=None, deadline=None):
260 del url
261 del deadline
259 return testing_common.FakeResponseObject(404, {}) 262 return testing_common.FakeResponseObject(404, {})
260 263
261 264
262 def _MockMakeRequest(path, *args, **kwargs): # pylint: disable=unused-argument 265 def _MockMakeRequest(path, *args, **kwargs): # pylint: disable=unused-argument
263 """Mocks out a request, returning a canned response.""" 266 """Mocks out a request, returning a canned response."""
264 if path.endswith('xsrf_token'): 267 if path.endswith('xsrf_token'):
265 assert kwargs['headers']['X-Requesting-XSRF-Token'] == 1 268 assert kwargs['headers']['X-Requesting-XSRF-Token'] == 1
266 return testing_common.FakeResponseObject(200, _FAKE_XSRF_TOKEN) 269 return testing_common.FakeResponseObject(200, _FAKE_XSRF_TOKEN)
267 if path == 'upload': 270 if path == 'upload':
268 assert kwargs['method'] == 'POST' 271 assert kwargs['method'] == 'POST'
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after
1033 testing_common.AddTests( 1036 testing_common.AddTests(
1034 ['M'], ['b'], 1037 ['M'], ['b'],
1035 {'benchmark': {'chart': {'page': {}}}}) 1038 {'benchmark': {'chart': {'page': {}}}})
1036 self.assertEqual( 1039 self.assertEqual(
1037 'chart/chart', 1040 'chart/chart',
1038 start_try_job.GuessMetric('M/b/benchmark/chart')) 1041 start_try_job.GuessMetric('M/b/benchmark/chart'))
1039 1042
1040 1043
1041 if __name__ == '__main__': 1044 if __name__ == '__main__':
1042 unittest.main() 1045 unittest.main()
OLDNEW
« no previous file with comments | « dashboard/dashboard/services/gitiles_service_test.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698