| OLD | NEW |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 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 mock | 5 import mock |
| 6 import unittest | 6 import unittest |
| 7 | 7 |
| 8 from apiclient.errors import HttpError | 8 from apiclient.errors import HttpError |
| 9 from endpoints import endpoints | 9 from endpoints_client import endpoints |
| 10 | 10 |
| 11 | 11 |
| 12 class EndpointsTestCase(unittest.TestCase): | 12 class EndpointsTestCase(unittest.TestCase): |
| 13 def setUp(self): | 13 def setUp(self): |
| 14 super(EndpointsTestCase, self).setUp() | 14 super(EndpointsTestCase, self).setUp() |
| 15 self.build = mock.Mock() | 15 self.build = mock.Mock() |
| 16 self.cred = mock.Mock() | 16 self.cred = mock.Mock() |
| 17 self.http = mock.Mock() | 17 self.http = mock.Mock() |
| 18 self.sleep = mock.Mock() | 18 self.sleep = mock.Mock() |
| 19 self.patchers = [ | 19 self.patchers = [ |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 endpoints.retry_request(request, num_tries=3) | 68 endpoints.retry_request(request, num_tries=3) |
| 69 | 69 |
| 70 def test_fails_requests_with_unsupported_retry_errors(self): | 70 def test_fails_requests_with_unsupported_retry_errors(self): |
| 71 request = mock.Mock() | 71 request = mock.Mock() |
| 72 request.execute.side_effect = [ | 72 request.execute.side_effect = [ |
| 73 HttpError(mock.Mock(status=400), 'err'), | 73 HttpError(mock.Mock(status=400), 'err'), |
| 74 'response' | 74 'response' |
| 75 ] | 75 ] |
| 76 with self.assertRaises(HttpError): | 76 with self.assertRaises(HttpError): |
| 77 endpoints.retry_request(request) | 77 endpoints.retry_request(request) |
| OLD | NEW |