def test_webDriver(self): dispatcher = Dispatcher() sample_command = expected_result = '|open|http://localhost/||' # Add one command to the command queue dispatcher.addCommand(sample_command) # Create a mock web request that simulates hitting 'driver' # for the first time req = REQUEST() req.form['seleniumStart'] = 'true' retrieved_result = dispatcher.webDriver(req) self.assertEquals(expected_result, retrieved_result)
def testAddCommand(self): dispatcher = Dispatcher() size = len(dispatcher._commands) self.assertEquals(0, size, '_commands queue should be empty') test_command = '|open|http://localhost/||' dispatcher.addCommand(test_command) # Now verify that the queue has one item size = len(dispatcher._commands) self.assertEquals(1, size, '_commands queue should have size of 1') # and check that we get out what we put in... self.assertEquals(test_command, dispatcher._commands.pop(0), "received unexpected value when calling 'pop(0)' on the queue")
def test_getCommand(self): dispatcher = Dispatcher() sample_command = expected_result = '|open|http://localhost/||' dispatcher.addCommand(sample_command) retrieved_result = dispatcher.getCommand() self.assertEquals(expected_result, retrieved_result)