| 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 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 | 312 |
| 313 # This is needed to be able to test handlers using cross-group transactions. | 313 # This is needed to be able to test handlers using cross-group transactions. |
| 314 datastore_stub_consistency_policy = ( | 314 datastore_stub_consistency_policy = ( |
| 315 datastore_stub_util.PseudoRandomHRConsistencyPolicy(probability=1)) | 315 datastore_stub_util.PseudoRandomHRConsistencyPolicy(probability=1)) |
| 316 | 316 |
| 317 # Needed to read queues from queue.yaml in the root of the app. | 317 # Needed to read queues from queue.yaml in the root of the app. |
| 318 taskqueue_stub_root_path = '' | 318 taskqueue_stub_root_path = '' |
| 319 | 319 |
| 320 def setUp(self): | 320 def setUp(self): |
| 321 super(CQStatusTestCase, self).setUp() | 321 super(CQStatusTestCase, self).setUp() |
| 322 ts_mon.reset_for_unittest() | 322 ts_mon.reset_for_unittest(disable=True) |
| 323 | 323 |
| 324 def test_create_tasks_to_update_issue_tracker(self): | 324 def test_create_tasks_to_update_issue_tracker(self): |
| 325 Flake(name='foo1', count_day=1).put() | 325 Flake(name='foo1', count_day=1).put() |
| 326 key2 = Flake(name='foo2', count_day=3).put() | 326 key2 = Flake(name='foo2', count_day=3).put() |
| 327 key3 = Flake(name='foo3', count_day=5).put() | 327 key3 = Flake(name='foo3', count_day=5).put() |
| 328 Flake(name='foo4', count_day=2).put() | 328 Flake(name='foo4', count_day=2).put() |
| 329 key5 = Flake(name='foo5', count_day=200).put() | 329 key5 = Flake(name='foo5', count_day=200).put() |
| 330 | 330 |
| 331 path = '/cron/update_issue_tracker' | 331 path = '/cron/update_issue_tracker' |
| 332 response = self.test_app.get(path, headers={'X-AppEngine-Cron': 'true'}) | 332 response = self.test_app.get(path, headers={'X-AppEngine-Cron': 'true'}) |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 | 582 |
| 583 dist = cq_status.occurrences_per_flake_week.get() | 583 dist = cq_status.occurrences_per_flake_week.get() |
| 584 self.assertEqual({2: 1, 8: 1, 11: 1}, dist.buckets) | 584 self.assertEqual({2: 1, 8: 1, 11: 1}, dist.buckets) |
| 585 self.assertEqual(20, dist.sum) | 585 self.assertEqual(20, dist.sum) |
| 586 self.assertEqual(3, dist.count) | 586 self.assertEqual(3, dist.count) |
| 587 | 587 |
| 588 dist = cq_status.occurrences_per_flake_month.get() | 588 dist = cq_status.occurrences_per_flake_month.get() |
| 589 self.assertEqual({5: 1, 11: 2}, dist.buckets) | 589 self.assertEqual({5: 1, 11: 2}, dist.buckets) |
| 590 self.assertEqual(32, dist.sum) | 590 self.assertEqual(32, dist.sum) |
| 591 self.assertEqual(3, dist.count) | 591 self.assertEqual(3, dist.count) |
| OLD | NEW |