Chromium Code Reviews| Index: scripts/master/unittests/exception_notifier_test.py |
| diff --git a/scripts/master/unittests/exception_notifier_test.py b/scripts/master/unittests/exception_notifier_test.py |
| new file mode 100755 |
| index 0000000000000000000000000000000000000000..fcc4018a04cf30f56ec18753a4ca7f176f8209be |
| --- /dev/null |
| +++ b/scripts/master/unittests/exception_notifier_test.py |
| @@ -0,0 +1,35 @@ |
| +#!/usr/bin/env python |
| +# Copyright (c) 2011 The Chromium Authors. All rights reserved. |
|
agable
2014/11/17 19:26:42
2014
Sergey Berezin
2015/01/06 21:39:48
Done.
|
| +# Use of this source code is governed by a BSD-style license that can be |
| +# found in the LICENSE file. |
| + |
| +"""ExceptionNofifier unittests.""" |
| + |
| +import unittest |
| + |
| +import test_env # pylint: disable=W0611 |
| + |
| +from buildbot.status import results |
| +from master import exception_notifier |
| + |
| + |
| +class BuildMock(object): |
| + # Silence Method could be a function: pylint: disable=R0201 |
| + def getBuilder(self): |
| + return None |
| + |
| + |
| +class ExceptionNotifierTest(unittest.TestCase): |
| + def test_mode_failing(self): |
| + notifier = exception_notifier.ExceptionNotifier( |
| + fromaddr='buildbot@test', |
| + mode='failing', |
| + ) |
| + self.assertTrue(notifier) |
| + self.assertTrue(notifier.isMailNeeded(BuildMock(), results.EXCEPTION)) |
| + self.assertTrue(notifier.isMailNeeded(BuildMock(), results.FAILURE)) |
| + self.assertFalse(notifier.isMailNeeded(BuildMock(), results.SUCCESS)) |
| + |
| + |
| +if __name__ == '__main__': |
| + unittest.main() |