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.common import errors | |
8 | |
9 class ErrorsTest(unittest.TestCase): | |
10 | |
11 ERRORS = [ | |
12 (errors.MonitoringDecreasingValueError, ('test', 1, 0)), | |
13 (errors.MonitoringDuplicateRegistrationError, ('test',)), | |
14 (errors.MonitoringIncrementUnsetValueError, ('test',)), | |
15 (errors.MonitoringInvalidValueTypeError, ('test', 'foo')), | |
16 (errors.MonitoringInvalidFieldTypeError, ('test', 'foo', 'bar')), | |
17 (errors.MonitoringTooManyFieldsError, ('test', {'foo': 'bar'})), | |
18 (errors.MonitoringNoConfiguredMonitorError, ('test',)), | |
19 (errors.MonitoringNoConfiguredMonitorError, (None,)), | |
20 (errors.MonitoringNoConfiguredTargetError, ('test',)), | |
21 (errors.UnknownModificationTypeError, ('foo',)), | |
22 ] | |
23 | |
24 def test_smoke(self): | |
25 for error_class, args in self.ERRORS: | |
26 with self.assertRaises(error_class) as e: | |
27 raise error_class(*args) | |
28 str(e.exception) | |
OLD | NEW |