Exemplo n.º 1
0
def test_upstream_http_proxy_basic_auth_empty_pass(driver_path, chrome_options, httpbin):
    httpproxy = None

    try:
        httpproxy = testutils.get_proxy(mode='http', port=8088, auth='test:')
        sw_options = {
            'proxy': {
                'https': f'{httpproxy}'
            }
        }

        driver = create_driver(driver_path, chrome_options, sw_options)
        driver.get(f'{httpbin}/html')

        assert 'This passed through a authenticated http proxy' in driver.page_source

        driver.quit()
    finally:
        if httpproxy:
            httpproxy.close()
Exemplo n.º 2
0
def test_upstream_http_proxy_custom_auth(driver_path, chrome_options, httpbin):
    httpproxy = None

    try:
        httpproxy = testutils.get_proxy(mode='http', port=8088, auth='test:test')
        sw_options = {
            'proxy': {
                'https': 'https://localhost:8088',
                'custom_authorization': 'Basic dGVzdDp0ZXN0',  # Omit newline from end of the string
            },
        }

        driver = create_driver(driver_path, chrome_options, sw_options)
        driver.get(f'{httpbin}/html')

        assert 'This passed through a authenticated http proxy' in driver.page_source

        driver.quit()
    finally:
        if httpproxy:
            httpproxy.close()
Exemplo n.º 3
0
def socksproxy():
    httpproxy = testutils.get_proxy(port=8087, mode='socks')
    yield httpproxy
    httpproxy.close()
Exemplo n.º 4
0
def httpproxy():
    httpproxy = testutils.get_proxy()
    yield httpproxy
    httpproxy.close()