How to use the splinter.request_handler.request_handler.RequestHandler function in splinter

To help you get started, we’ve selected a few splinter examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cobrateam / splinter / tests / test_request_handler.py View on Github external
def test_should_get_an_exception_and_format_it(self):
        request = RequestHandler()
        request.connect(EXAMPLE_APP + "page-that-doesnt-exists")
        try:
            request.ensure_success_response()
        except HttpResponseError as e:
            exception = e.msg
        self.assertEqual("404 - Not Found", exception)
github cobrateam / splinter / tests / test_request_handler.py View on Github external
def test_should_connect_to_pages_with_query_string(self):
        request = RequestHandler()
        url = EXAMPLE_APP + "query?model"
        request.connect(url)
        self.assertTrue(request.status_code.is_success())
github cobrateam / splinter / tests / test_request_handler.py View on Github external
def test_should_visit_alert_page_and_get_a_success_response(self):
        request = RequestHandler()
        request.connect(EXAMPLE_APP + "alert")
        self.assertTrue(request.status_code.is_success())
github cobrateam / splinter / tests / test_request_handler.py View on Github external
def test_should_connect_to_https_protocols(self):
        # We do not run an HTTPS server, but we know we handle https
        # if we get an SSLError accessing a non-HTTPS site.
        with self.assertRaises(SSLError):
            request = RequestHandler()
            url = EXAMPLE_APP.replace('http', 'https')
            request.connect(url)
            self.assertEqual(request.scheme, 'https')
github cobrateam / splinter / tests / test_request_handler.py View on Github external
def setUp(self):
        self.request = RequestHandler()
        self.request.connect(EXAMPLE_APP)
github cobrateam / splinter / tests / test_request_handler.py View on Github external
def test_should_be_able_to_connect_with_basic_auth(self):
        request = RequestHandler()
        url = 'http://admin:secret@localhost:5000/authenticate'
        request.connect(url)
        self.assertEqual(b'Success!', request.response.read())
github cobrateam / splinter / tests / test_request_handler.py View on Github external
def test_should_get_an_absent_url_and_raise_an_exception(self):
        with self.assertRaises(HttpResponseError):
            request = RequestHandler()
            request.connect(EXAMPLE_APP + "page-that-doesnt-exists")
            request.ensure_success_response()
github cobrateam / splinter / tests / test_request_handler.py View on Github external
def test_should_set_user_agent(self):
        request = RequestHandler()
        url = EXAMPLE_APP + 'useragent'
        request.connect(url)
        self.assertEqual(b'python/splinter', request.response.read())
github cobrateam / splinter / tests / test_request_handler.py View on Github external
def test_is_success_should_be_false_when_url_does_not_exists(self):
        request = RequestHandler()
        request.connect(EXAMPLE_APP + "page-that-doesnt-exists")
        self.assertFalse(request.status_code.is_success())
github cobrateam / splinter / tests / test_request_handler.py View on Github external
def test_should_not_connect_to_non_http_protocols(self):
        mockfile_path = "file://%s" % os.path.join(TESTS_ROOT, "mockfile.txt")
        request = RequestHandler()
        request.connect(mockfile_path)
        self.assertTrue(request.status_code.is_success())