| OLD | NEW |
| (Empty) | |
| 1 #!/usr/bin/env python |
| 2 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. |
| 5 |
| 6 """ExceptionNofifier unittests.""" |
| 7 |
| 8 import unittest |
| 9 |
| 10 import test_env # pylint: disable=W0611 |
| 11 |
| 12 from buildbot.status import results |
| 13 from master import exception_notifier |
| 14 |
| 15 |
| 16 class BuildMock(object): |
| 17 # Silence Method could be a function: pylint: disable=R0201 |
| 18 def getBuilder(self): |
| 19 return None |
| 20 |
| 21 |
| 22 class ExceptionNotifierTest(unittest.TestCase): |
| 23 def test_mode_failing(self): |
| 24 notifier = exception_notifier.ExceptionNotifier( |
| 25 fromaddr='buildbot@test', |
| 26 mode='failing', |
| 27 ) |
| 28 self.assertTrue(notifier) |
| 29 self.assertTrue(notifier.isMailNeeded(BuildMock(), results.EXCEPTION)) |
| 30 self.assertTrue(notifier.isMailNeeded(BuildMock(), results.FAILURE)) |
| 31 self.assertFalse(notifier.isMailNeeded(BuildMock(), results.SUCCESS)) |
| 32 |
| 33 |
| 34 if __name__ == '__main__': |
| 35 unittest.main() |
| OLD | NEW |