test_ui_gtk2.py 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. """ Unit test for reportbug.ui.gtk2_ui module """
  2. import unittest2
  3. from nose.plugins.attrib import attr
  4. from reportbug import utils
  5. from reportbug.ui import gtk2_ui as ui
  6. import debianbts
  7. class TestUIGTK2(unittest2.TestCase):
  8. @attr('network') # marking the test as using network
  9. def test_bug_class(self):
  10. bug = debianbts.get_status(415801)[0]
  11. gtk_bug = ui.Bug(bug)
  12. self.assertIsNotNone(gtk_bug)
  13. self.assertEqual(bug.bug_num, gtk_bug.id)
  14. self.assertEqual(bug.severity, gtk_bug.severity)
  15. self.assertEqual(bug.package, gtk_bug.package)
  16. self.assertEqual(bug.originator, gtk_bug.reporter)
  17. self.assertEqual(bug.date, gtk_bug.date)
  18. for tag in bug.tags:
  19. self.assertIn(tag, gtk_bug.tag)
  20. for item in gtk_bug:
  21. self.assertIsNotNone(item)
  22. # These tests were written in the main module,
  23. # moved here to see if they can be interested somehow,
  24. # but to use them, we'd need to find a way to interact
  25. # programmatically with the GTK+ widgets
  26. # def test ():
  27. # # Write some tests here
  28. # print get_password ("test")
  29. # print select_options ('test', 'A', {'a': 'A test'})
  30. # print get_multiline ('ENTER', empty_ok=True)
  31. # print get_string ("test")
  32. # print system ("yes")
  33. # page = HandleBTSQueryPage (assistant)
  34. # application.run_once_in_main_thread (page.execute_operation, [('test', (Bug ('#123 [test] [we] we we Reported by: test;' ), Bug ('#123 [test] [we] we we Reported by: test;')))], 'test')
  35. # return application.get_last_value ()