| OLD | NEW |
| (Empty) |
| 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 | |
| 3 # found in the LICENSE file. | |
| 4 | |
| 5 import unittest | |
| 6 | |
| 7 from infra_libs.ts_mon import errors | |
| 8 | |
| 9 | |
| 10 class ErrorsTest(unittest.TestCase): | |
| 11 | |
| 12 def test_decreasing_value(self): | |
| 13 with self.assertRaises(errors.MonitoringDecreasingValueError) as e: | |
| 14 raise errors.MonitoringDecreasingValueError('test', 1, 0) | |
| 15 str(e.exception) | |
| 16 | |
| 17 def test_duplicate_registration(self): | |
| 18 with self.assertRaises(errors.MonitoringDuplicateRegistrationError) as e: | |
| 19 raise errors.MonitoringDuplicateRegistrationError('test') | |
| 20 str(e.exception) | |
| 21 | |
| 22 def test_increment_unset_value(self): | |
| 23 with self.assertRaises(errors.MonitoringIncrementUnsetValueError) as e: | |
| 24 raise errors.MonitoringIncrementUnsetValueError('test') | |
| 25 str(e.exception) | |
| 26 | |
| 27 def test_invalid_value_type(self): | |
| 28 with self.assertRaises(errors.MonitoringInvalidValueTypeError) as e: | |
| 29 raise errors.MonitoringInvalidValueTypeError('test', 'foo') | |
| 30 str(e.exception) | |
| 31 | |
| 32 def test_invalid_field_type(self): | |
| 33 with self.assertRaises(errors.MonitoringInvalidFieldTypeError) as e: | |
| 34 raise errors.MonitoringInvalidFieldTypeError('test', 'foo', 'bar') | |
| 35 str(e.exception) | |
| 36 | |
| 37 def test_too_many_fields(self): | |
| 38 with self.assertRaises(errors.MonitoringTooManyFieldsError) as e: | |
| 39 raise errors.MonitoringTooManyFieldsError('test', {'foo': 'bar'}) | |
| 40 str(e.exception) | |
| 41 | |
| 42 def test_no_configured_monitor(self): | |
| 43 with self.assertRaises(errors.MonitoringNoConfiguredMonitorError) as e: | |
| 44 raise errors.MonitoringNoConfiguredMonitorError('test') | |
| 45 str(e.exception) | |
| 46 | |
| 47 def test_no_configured_monitor_flush(self): | |
| 48 with self.assertRaises(errors.MonitoringNoConfiguredMonitorError) as e: | |
| 49 raise errors.MonitoringNoConfiguredMonitorError(None) | |
| 50 str(e.exception) | |
| 51 | |
| 52 def test_no_configured_target(self): | |
| 53 with self.assertRaises(errors.MonitoringNoConfiguredTargetError) as e: | |
| 54 raise errors.MonitoringNoConfiguredTargetError('test') | |
| 55 str(e.exception) | |
| OLD | NEW |