def test_webDriver_with_no_REQUEST(self): """ This error would come up if 'driver()' was called from an XML-RPC client instead of a 'straight' page request from a web browser """ dispatcher = Dispatcher() self.assertEquals(dispatcher.webDriver(), "ERROR: Missing an HTTP REQUEST")
def test_webDriver_with_empty_command_queue(self): req = REQUEST() dispatcher = Dispatcher() #speed up the queue timeout for testing dispatcher.QUEUE_TIMEOUT = .001 self.assertEquals(dispatcher.webDriver(req), 'ERROR: Command queue was empty')
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)