| @@ 28-61 (lines=34) @@ | ||
| 25 | ) |
|
| 26 | ||
| 27 | ||
| 28 | class GetAlertConditionFromStringTestCase(unittest.TestCase): |
|
| 29 | def test_invalid(self): |
|
| 30 | with self.assertRaises(InvalidArgument): |
|
| 31 | get_alert_condition_from_string('foo') |
|
| 32 | ||
| 33 | def test_none_or_empty(self): |
|
| 34 | ct = get_alert_condition_from_string(None) |
|
| 35 | self.assertIsNone(ct) |
|
| 36 | ct = get_alert_condition_from_string('') |
|
| 37 | self.assertIsNone(ct) |
|
| 38 | ||
| 39 | def test_always(self): |
|
| 40 | ct = get_alert_condition_from_string('always') |
|
| 41 | self.assertEqual(ct, AlertCondition.ALWAYS) |
|
| 42 | ||
| 43 | def test_filter_count_at_least(self): |
|
| 44 | ct = get_alert_condition_from_string('filter count at least') |
|
| 45 | self.assertEqual(ct, AlertCondition.FILTER_COUNT_AT_LEAST) |
|
| 46 | ||
| 47 | def test_filter_count_changed(self): |
|
| 48 | ct = get_alert_condition_from_string('filter count changed') |
|
| 49 | self.assertEqual(ct, AlertCondition.FILTER_COUNT_CHANGED) |
|
| 50 | ||
| 51 | def test_severity_at_least(self): |
|
| 52 | ct = get_alert_condition_from_string('severity at least') |
|
| 53 | self.assertEqual(ct, AlertCondition.SEVERITY_AT_LEAST) |
|
| 54 | ||
| 55 | def test_severity_changed(self): |
|
| 56 | ct = get_alert_condition_from_string('severity changed') |
|
| 57 | self.assertEqual(ct, AlertCondition.SEVERITY_CHANGED) |
|
| 58 | ||
| 59 | def test_error(self): |
|
| 60 | ct = get_alert_condition_from_string('error') |
|
| 61 | self.assertEqual(ct, AlertCondition.ERROR) |
|
| 62 | ||
| 63 | ||
| 64 | if __name__ == '__main__': |
|
| @@ 28-61 (lines=34) @@ | ||
| 25 | ) |
|
| 26 | ||
| 27 | ||
| 28 | class GetAlertConditionFromStringTestCase(unittest.TestCase): |
|
| 29 | def test_invalid(self): |
|
| 30 | with self.assertRaises(InvalidArgument): |
|
| 31 | get_alert_condition_from_string('foo') |
|
| 32 | ||
| 33 | def test_none_or_empty(self): |
|
| 34 | ct = get_alert_condition_from_string(None) |
|
| 35 | self.assertIsNone(ct) |
|
| 36 | ct = get_alert_condition_from_string('') |
|
| 37 | self.assertIsNone(ct) |
|
| 38 | ||
| 39 | def test_always(self): |
|
| 40 | ct = get_alert_condition_from_string('always') |
|
| 41 | self.assertEqual(ct, AlertCondition.ALWAYS) |
|
| 42 | ||
| 43 | def test_filter_count_at_least(self): |
|
| 44 | ct = get_alert_condition_from_string('filter count at least') |
|
| 45 | self.assertEqual(ct, AlertCondition.FILTER_COUNT_AT_LEAST) |
|
| 46 | ||
| 47 | def test_filter_count_changed(self): |
|
| 48 | ct = get_alert_condition_from_string('filter count changed') |
|
| 49 | self.assertEqual(ct, AlertCondition.FILTER_COUNT_CHANGED) |
|
| 50 | ||
| 51 | def test_severity_at_least(self): |
|
| 52 | ct = get_alert_condition_from_string('severity at least') |
|
| 53 | self.assertEqual(ct, AlertCondition.SEVERITY_AT_LEAST) |
|
| 54 | ||
| 55 | def test_severity_changed(self): |
|
| 56 | ct = get_alert_condition_from_string('severity changed') |
|
| 57 | self.assertEqual(ct, AlertCondition.SEVERITY_CHANGED) |
|
| 58 | ||
| 59 | def test_error(self): |
|
| 60 | ct = get_alert_condition_from_string('error') |
|
| 61 | self.assertEqual(ct, AlertCondition.ERROR) |
|
| 62 | ||
| 63 | ||
| 64 | if __name__ == '__main__': |
|