added more unit tests

This commit is contained in:
Corey Goldberg 2013-04-04 12:09:28 -04:00
parent 347a7f3f2c
commit a64f688375
1 changed files with 13 additions and 1 deletions

View File

@ -16,13 +16,25 @@ class TestXvfb(unittest.TestCase):
self.assertEqual(':%d' % xvfb.vdisplay_num, os.environ['DISPLAY']) self.assertEqual(':%d' % xvfb.vdisplay_num, os.environ['DISPLAY'])
self.assertIsNot(None, xvfb.proc) self.assertIsNot(None, xvfb.proc)
def test_start_with_args(self):
w = 800
h = 600
depth = 16
xvfb = Xvfb(width=w, height=h, colordepth=depth)
xvfb.start()
self.assertEqual(w, xvfb.width)
self.assertEqual(h, xvfb.height)
self.assertEqual(depth, xvfb.colordepth)
self.assertEqual(os.environ['DISPLAY'], ':%d' % xvfb.vdisplay_num)
self.assertIsNot(None, xvfb.proc)
def test_stop(self): def test_stop(self):
orig = os.environ['DISPLAY'] orig = os.environ['DISPLAY']
xvfb = Xvfb() xvfb = Xvfb()
xvfb.start() xvfb.start()
self.assertNotEqual(orig, os.environ['DISPLAY']) self.assertNotEqual(orig, os.environ['DISPLAY'])
xvfb.stop() xvfb.stop()
self.assertEquals(orig, os.environ['DISPLAY']) self.assertEqual(orig, os.environ['DISPLAY'])
if __name__ == '__main__': if __name__ == '__main__':