| OLD | NEW |
| 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 datetime | 5 import datetime |
| 6 import json | 6 import json |
| 7 import mock | 7 import mock |
| 8 import urllib2 | 8 import urllib2 |
| 9 | 9 |
| 10 from google.appengine.datastore import datastore_stub_util | 10 from google.appengine.datastore import datastore_stub_util |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 taskqueue_stub_root_path = '.' | 171 taskqueue_stub_root_path = '.' |
| 172 | 172 |
| 173 def setUp(self): | 173 def setUp(self): |
| 174 super(FlakeIssuesTestCase, self).setUp() | 174 super(FlakeIssuesTestCase, self).setUp() |
| 175 gae_ts_mon.reset_for_unittest(disable=True) | 175 gae_ts_mon.reset_for_unittest(disable=True) |
| 176 self.mock_api = MockIssueTrackerAPI() | 176 self.mock_api = MockIssueTrackerAPI() |
| 177 self.patchers = [ | 177 self.patchers = [ |
| 178 mock.patch('issue_tracker.issue_tracker_api.IssueTrackerAPI', | 178 mock.patch('issue_tracker.issue_tracker_api.IssueTrackerAPI', |
| 179 lambda *args, **kwargs: self.mock_api), | 179 lambda *args, **kwargs: self.mock_api), |
| 180 mock.patch('issue_tracker.issue.Issue', MockIssue), | 180 mock.patch('issue_tracker.issue.Issue', MockIssue), |
| 181 mock.patch('findit.findit.FindItAPI', mock.Mock()), |
| 181 ] | 182 ] |
| 182 for patcher in self.patchers: | 183 for patcher in self.patchers: |
| 183 patcher.start() | 184 patcher.start() |
| 184 | 185 |
| 185 def tearDown(self): | 186 def tearDown(self): |
| 186 super(FlakeIssuesTestCase, self).tearDown() | 187 super(FlakeIssuesTestCase, self).tearDown() |
| 187 for patcher in self.patchers: | 188 for patcher in self.patchers: |
| 188 patcher.stop() | 189 patcher.stop() |
| 189 | 190 |
| 190 def _create_flake(self): | 191 def _create_flake(self): |
| (...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1045 key = Flake(name='foobar', issue_id=issue.id).put() | 1046 key = Flake(name='foobar', issue_id=issue.id).put() |
| 1046 self.test_app.get( | 1047 self.test_app.get( |
| 1047 '/override_issue_id?key=%s&issue_id=%d' % (key.urlsafe(), issue.id)) | 1048 '/override_issue_id?key=%s&issue_id=%d' % (key.urlsafe(), issue.id)) |
| 1048 self.assertEqual(key.get().issue_id, issue.id) | 1049 self.assertEqual(key.get().issue_id, issue.id) |
| 1049 | 1050 |
| 1050 def test_overrides_issue_id_with_0(self): | 1051 def test_overrides_issue_id_with_0(self): |
| 1051 key = Flake(name='foobar', issue_id=100000).put() | 1052 key = Flake(name='foobar', issue_id=100000).put() |
| 1052 self.test_app.get( | 1053 self.test_app.get( |
| 1053 '/override_issue_id?key=%s&issue_id=0' % key.urlsafe()) | 1054 '/override_issue_id?key=%s&issue_id=0' % key.urlsafe()) |
| 1054 self.assertEqual(key.get().issue_id, 0) | 1055 self.assertEqual(key.get().issue_id, 0) |
| OLD | NEW |