test_exception.py 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. from __future__ import with_statement
  2. import unittest2
  3. from reportbug import exceptions
  4. class TestExceptions(unittest2.TestCase):
  5. def test_raises_reportbug_exception(self):
  6. with self.assertRaises(exceptions.reportbug_exception):
  7. raise exceptions.reportbug_exception
  8. def test_raises_reportbug_ui_exception(self):
  9. with self.assertRaises(exceptions.reportbug_ui_exception):
  10. raise exceptions.reportbug_ui_exception
  11. def test_raises_UINotImportable(self):
  12. with self.assertRaises(exceptions.UINotImportable):
  13. raise exceptions.UINotImportable
  14. def test_raises_NoPackage(self):
  15. with self.assertRaises(exceptions.NoPackage):
  16. raise exceptions.NoPackage
  17. def test_raises_NoBugs(self):
  18. with self.assertRaises(exceptions.NoBugs):
  19. raise exceptions.NoBugs
  20. def test_raises_NoReport(self):
  21. with self.assertRaises(exceptions.NoReport):
  22. raise exceptions.NoReport
  23. def test_raises_UINotImplemented(self):
  24. with self.assertRaises(exceptions.UINotImplemented):
  25. raise exceptions.UINotImplemented
  26. def test_raises_NoNetwork(self):
  27. with self.assertRaises(exceptions.NoNetwork):
  28. raise exceptions.NoNetwork
  29. def test_raises_InvalidRegex(self):
  30. with self.assertRaises(exceptions.InvalidRegex):
  31. raise exceptions.InvalidRegex
  32. def test_raises_NoMessage(self):
  33. with self.assertRaises(exceptions.NoMessage):
  34. raise exceptions.NoMessage