| 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 argparse | 5 import argparse |
| 6 import json | 6 import json |
| 7 import requests | 7 import requests |
| 8 import tempfile | 8 import tempfile |
| 9 import unittest | 9 import unittest |
| 10 | 10 |
| 11 import mock | 11 import mock |
| 12 | 12 |
| 13 from testing_support import auto_stub | 13 from testing_support import auto_stub |
| 14 | 14 |
| 15 from infra_libs.ts_mon import config | 15 from infra_libs.ts_mon import config |
| 16 from infra_libs.ts_mon import interface | 16 from infra_libs.ts_mon import interface |
| 17 from infra_libs.ts_mon import standard_metrics | 17 from infra_libs.ts_mon.common import standard_metrics |
| 18 from infra_libs.ts_mon.test import stubs | 18 from infra_libs.ts_mon.test import stubs |
| 19 | 19 |
| 20 | 20 |
| 21 class GlobalsTest(auto_stub.TestCase): | 21 class GlobalsTest(auto_stub.TestCase): |
| 22 | 22 |
| 23 def setUp(self): | 23 def setUp(self): |
| 24 super(GlobalsTest, self).setUp() | 24 super(GlobalsTest, self).setUp() |
| 25 self.mock(interface, 'state', stubs.MockState()) | 25 self.mock(interface, 'state', stubs.MockState()) |
| 26 self.mock(config, 'load_machine_config', lambda x: {}) | 26 self.mock(config, 'load_machine_config', lambda x: {}) |
| 27 | 27 |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 | 246 |
| 247 def test_load_machine_config_bad(self): | 247 def test_load_machine_config_bad(self): |
| 248 with tempfile.NamedTemporaryFile() as fh: | 248 with tempfile.NamedTemporaryFile() as fh: |
| 249 fh.write('not a json file') | 249 fh.write('not a json file') |
| 250 fh.flush() | 250 fh.flush() |
| 251 with self.assertRaises(ValueError): | 251 with self.assertRaises(ValueError): |
| 252 config.load_machine_config(fh.name) | 252 config.load_machine_config(fh.name) |
| 253 | 253 |
| 254 def test_load_machine_config_not_exists(self): | 254 def test_load_machine_config_not_exists(self): |
| 255 self.assertEquals({}, config.load_machine_config('does not exist')) | 255 self.assertEquals({}, config.load_machine_config('does not exist')) |
| OLD | NEW |