mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2026-06-29 06:06:09 +00:00
test
This commit is contained in:
parent
86b32ee0da
commit
6c585b9de8
@ -160,7 +160,7 @@ class WebSocketProxyHandler(BaseRequestHandler):
|
|||||||
import websockets.sync.server
|
import websockets.sync.server
|
||||||
self.request.settimeout(None)
|
self.request.settimeout(None)
|
||||||
protocol = websockets.ServerProtocol()
|
protocol = websockets.ServerProtocol()
|
||||||
connection = websockets.sync.server.ServerConnection(socket=self.request, protocol=protocol, close_timeout=2)
|
connection = websockets.sync.server.ServerConnection(socket=self.request, protocol=protocol, close_timeout=0)
|
||||||
connection.handshake()
|
connection.handshake()
|
||||||
for message in connection:
|
for message in connection:
|
||||||
if message == 'proxy_info':
|
if message == 'proxy_info':
|
||||||
@ -438,11 +438,11 @@ class TestHTTPConnectProxy:
|
|||||||
assert proxy_info['client_address'][0] == source_address
|
assert proxy_info['client_address'][0] == source_address
|
||||||
|
|
||||||
@pytest.mark.skipif(urllib3 is None, reason='requires urllib3 to test')
|
@pytest.mark.skipif(urllib3 is None, reason='requires urllib3 to test')
|
||||||
@pytest.mark.skip_handler_if(
|
# @pytest.mark.skip_handler_if(
|
||||||
'Websockets', lambda request:
|
# 'Websockets', lambda request:
|
||||||
(platform.python_implementation() == 'PyPy'
|
# (platform.python_implementation() == 'PyPy'
|
||||||
and request.getfixturevalue('ctx').REQUEST_PROTO == 'wss'),
|
# and request.getfixturevalue('ctx').REQUEST_PROTO == 'wss'),
|
||||||
'PyPy sometimes fails with WSS over TLS tests, unknown reason')
|
# 'PyPy sometimes fails with WSS over TLS tests, unknown reason')
|
||||||
def test_https_connect_proxy(self, handler, ctx):
|
def test_https_connect_proxy(self, handler, ctx):
|
||||||
with ctx.http_server(HTTPSConnectProxyHandler) as server_address:
|
with ctx.http_server(HTTPSConnectProxyHandler) as server_address:
|
||||||
with handler(verify=False, proxies={ctx.REQUEST_PROTO: f'https://{server_address}'}) as rh:
|
with handler(verify=False, proxies={ctx.REQUEST_PROTO: f'https://{server_address}'}) as rh:
|
||||||
@ -452,11 +452,11 @@ class TestHTTPConnectProxy:
|
|||||||
assert 'Proxy-Authorization' not in proxy_info['headers']
|
assert 'Proxy-Authorization' not in proxy_info['headers']
|
||||||
|
|
||||||
@pytest.mark.skipif(urllib3 is None, reason='requires urllib3 to test')
|
@pytest.mark.skipif(urllib3 is None, reason='requires urllib3 to test')
|
||||||
@pytest.mark.skip_handler_if(
|
# @pytest.mark.skip_handler_if(
|
||||||
'Websockets', lambda request:
|
# 'Websockets', lambda request:
|
||||||
(platform.python_implementation() == 'PyPy'
|
# (platform.python_implementation() == 'PyPy'
|
||||||
and request.getfixturevalue('ctx').REQUEST_PROTO == 'wss'),
|
# and request.getfixturevalue('ctx').REQUEST_PROTO == 'wss'),
|
||||||
'PyPy sometimes fails with WSS over TLS tests, unknown reason')
|
# 'PyPy sometimes fails with WSS over TLS tests, unknown reason')
|
||||||
def test_https_connect_verify_failed(self, handler, ctx):
|
def test_https_connect_verify_failed(self, handler, ctx):
|
||||||
with ctx.http_server(HTTPSConnectProxyHandler) as server_address:
|
with ctx.http_server(HTTPSConnectProxyHandler) as server_address:
|
||||||
with handler(verify=True, proxies={ctx.REQUEST_PROTO: f'https://{server_address}'}) as rh:
|
with handler(verify=True, proxies={ctx.REQUEST_PROTO: f'https://{server_address}'}) as rh:
|
||||||
@ -467,11 +467,11 @@ class TestHTTPConnectProxy:
|
|||||||
ctx.proxy_info_request(rh)
|
ctx.proxy_info_request(rh)
|
||||||
|
|
||||||
@pytest.mark.skipif(urllib3 is None, reason='requires urllib3 to test')
|
@pytest.mark.skipif(urllib3 is None, reason='requires urllib3 to test')
|
||||||
@pytest.mark.skip_handler_if(
|
# @pytest.mark.skip_handler_if(
|
||||||
'Websockets', lambda request:
|
# 'Websockets', lambda request:
|
||||||
(platform.python_implementation() == 'PyPy'
|
# (platform.python_implementation() == 'PyPy'
|
||||||
and request.getfixturevalue('ctx').REQUEST_PROTO == 'wss'),
|
# and request.getfixturevalue('ctx').REQUEST_PROTO == 'wss'),
|
||||||
'PyPy sometimes fails with WSS over TLS tests, unknown reason')
|
# 'PyPy sometimes fails with WSS over TLS tests, unknown reason')
|
||||||
def test_https_connect_proxy_auth(self, handler, ctx):
|
def test_https_connect_proxy_auth(self, handler, ctx):
|
||||||
with ctx.http_server(HTTPSConnectProxyHandler, username='test', password='test') as server_address:
|
with ctx.http_server(HTTPSConnectProxyHandler, username='test', password='test') as server_address:
|
||||||
with handler(verify=False, proxies={ctx.REQUEST_PROTO: f'https://test:test@{server_address}'}) as rh:
|
with handler(verify=False, proxies={ctx.REQUEST_PROTO: f'https://test:test@{server_address}'}) as rh:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user