class TestPool(unittest.TestCase): def setUp(self): self.pool = WebPool() def test_object(self): self.assertIsInstance(self.pool, WebPool) def test_empty(self): self.assertDictEqual(self.pool.browsers, {}) self.assertDictEqual(self.pool.result, {}) self.assertDictEqual(self.pool.actions, {}) self.assertEquals(self.pool.ignored, ('send_keys', 'get')) def test_start(self): self.pool.start() brs = {'chrome': webdriver.Chrome, 'chrome1': webdriver.Chrome, 'chrome2': webdriver.Chrome} self.pool.browsers = brs self.assertEquals(self.pool.browsers.keys(), ['chrome', 'chrome1', 'chrome2']) self.pool.start() self.assertEquals(self.pool.result.keys(), ['chrome', 'chrome1', 'chrome2']) self.pool.stop() self.assertDictEqual(self.pool.result, {})
def setUp(self): self.pool = WebPool()