| 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 datetime | 5 import datetime |
| 6 import mock | 6 import mock |
| 7 import unittest | 7 import unittest |
| 8 | 8 |
| 9 import issue_tracker | 9 import issue_tracker |
| 10 | 10 |
| 11 | 11 |
| 12 class IssueTrackerAPITestCase(unittest.TestCase): | 12 class IssueTrackerAPITestCase(unittest.TestCase): |
| 13 def setUp(self): | 13 def setUp(self): |
| 14 super(IssueTrackerAPITestCase, self).setUp() | 14 super(IssueTrackerAPITestCase, self).setUp() |
| 15 self.maxDiff = None | 15 self.maxDiff = None |
| 16 self.client = mock.Mock() | 16 self.client = mock.Mock() |
| 17 self.build_client = mock.Mock(return_value=self.client) | 17 self.build_client = mock.Mock(return_value=self.client) |
| 18 self.patchers = [ | 18 self.patchers = [ |
| 19 mock.patch('endpoints.endpoints.build_client', self.build_client), | 19 mock.patch( |
| 20 mock.patch('endpoints.endpoints.retry_request', | 20 'endpoints_client.endpoints.build_client', self.build_client), |
| 21 mock.patch('endpoints_client.endpoints.retry_request', |
| 21 lambda request: request.execute()), | 22 lambda request: request.execute()), |
| 22 ] | 23 ] |
| 23 for patcher in self.patchers: | 24 for patcher in self.patchers: |
| 24 patcher.start() | 25 patcher.start() |
| 25 | 26 |
| 26 def tearDown(self): | 27 def tearDown(self): |
| 27 super(IssueTrackerAPITestCase, self).tearDown() | 28 super(IssueTrackerAPITestCase, self).tearDown() |
| 28 for patcher in self.patchers: | 29 for patcher in self.patchers: |
| 29 patcher.stop() | 30 patcher.stop() |
| 30 | 31 |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 issue_tracker.IssueTrackerAPI('my-project') | 205 issue_tracker.IssueTrackerAPI('my-project') |
| 205 self.build_client.assert_called_with( | 206 self.build_client.assert_called_with( |
| 206 'monorail', 'v1', 'https://monorail-staging.appspot.com/_ah/api/' | 207 'monorail', 'v1', 'https://monorail-staging.appspot.com/_ah/api/' |
| 207 'discovery/v1/apis/{api}/{apiVersion}/rest') | 208 'discovery/v1/apis/{api}/{apiVersion}/rest') |
| 208 | 209 |
| 209 def test_uses_prod_instance_by_default(self): | 210 def test_uses_prod_instance_by_default(self): |
| 210 issue_tracker.IssueTrackerAPI('my-project') | 211 issue_tracker.IssueTrackerAPI('my-project') |
| 211 self.build_client.assert_called_with( | 212 self.build_client.assert_called_with( |
| 212 'monorail', 'v1', 'https://monorail-prod.appspot.com/_ah/api/' | 213 'monorail', 'v1', 'https://monorail-prod.appspot.com/_ah/api/' |
| 213 'discovery/v1/apis/{api}/{apiVersion}/rest') | 214 'discovery/v1/apis/{api}/{apiVersion}/rest') |
| OLD | NEW |