| 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 copy | 5 import copy |
| 6 import datetime | 6 import datetime |
| 7 import functools | 7 import functools |
| 8 import os | 8 import os |
| 9 import time | 9 import time |
| 10 import unittest | 10 import unittest |
| 11 | 11 |
| 12 import endpoints | 12 import endpoints |
| 13 import gae_ts_mon | 13 import gae_ts_mon |
| 14 import mock | 14 import mock |
| 15 import webapp2 | 15 import webapp2 |
| 16 | 16 |
| 17 from infra_libs.ts_mon import config | 17 from infra_libs.ts_mon import config |
| 18 from infra_libs.ts_mon import shared | 18 from infra_libs.ts_mon import shared |
| 19 from infra_libs.ts_mon.common import http_metrics | 19 from infra_libs.ts_mon.common import http_metrics |
| 20 from infra_libs.ts_mon.common import interface | 20 from infra_libs.ts_mon.common import interface |
| 21 from infra_libs.ts_mon.common import monitors | 21 from infra_libs.ts_mon.common import monitors |
| 22 from infra_libs.ts_mon.common import targets | 22 from infra_libs.ts_mon.common import targets |
| 23 from infra_libs.ts_mon.common.test import stubs | |
| 24 from protorpc import message_types | 23 from protorpc import message_types |
| 25 from protorpc import remote | 24 from protorpc import remote |
| 26 from testing_utils import testing | 25 from testing_utils import testing |
| 27 | 26 |
| 28 | 27 |
| 29 class InitializeTest(testing.AppengineTestCase): | 28 class InitializeTest(testing.AppengineTestCase): |
| 30 def setUp(self): | 29 def setUp(self): |
| 31 super(InitializeTest, self).setUp() | 30 super(InitializeTest, self).setUp() |
| 32 | 31 |
| 33 config.reset_for_unittest() | 32 config.reset_for_unittest() |
| (...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 585 | 584 |
| 586 @mock.patch('gae_ts_mon.config.need_to_flush_metrics', autospec=True, | 585 @mock.patch('gae_ts_mon.config.need_to_flush_metrics', autospec=True, |
| 587 return_value=False) | 586 return_value=False) |
| 588 def test_no_flush(self, _fake): | 587 def test_no_flush(self, _fake): |
| 589 # For branch coverage. | 588 # For branch coverage. |
| 590 self.run_middleware() | 589 self.run_middleware() |
| 591 | 590 |
| 592 fields = {'name': 'gae_ts_mon.test.config_test.view_func', | 591 fields = {'name': 'gae_ts_mon.test.config_test.view_func', |
| 593 'status': 200, 'is_robot': False} | 592 'status': 200, 'is_robot': False} |
| 594 self.assertEqual(1, http_metrics.server_response_status.get(fields)) | 593 self.assertEqual(1, http_metrics.server_response_status.get(fields)) |
| OLD | NEW |