fix tests
This commit is contained in:
parent
fa6e8f1e9c
commit
76f0b8f65e
|
@ -102,6 +102,7 @@ with outfile.open("w") as f, contextlib.redirect_stdout(f):
|
|||
http.HttpResponseHook,
|
||||
http.HttpErrorHook,
|
||||
http.HttpConnectHook,
|
||||
http.HttpConnectUpstreamHook,
|
||||
]
|
||||
)
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ from ._base import HttpCommand, HttpConnection, ReceiveHttp, StreamId
|
|||
from ._events import HttpEvent, RequestData, RequestEndOfMessage, RequestHeaders, RequestProtocolError, RequestTrailers, \
|
||||
ResponseData, ResponseEndOfMessage, ResponseHeaders, ResponseProtocolError, ResponseTrailers
|
||||
from ._hooks import HttpConnectHook, HttpErrorHook, HttpRequestHeadersHook, HttpRequestHook, HttpResponseHeadersHook, \
|
||||
HttpResponseHook
|
||||
HttpResponseHook, HttpConnectUpstreamHook # noqa
|
||||
from ._http1 import Http1Client, Http1Connection, Http1Server
|
||||
from ._http2 import Http2Client, Http2Server
|
||||
from ...context import Context
|
||||
|
|
|
@ -34,6 +34,7 @@ class HttpUpstreamProxy(tunnel.TunnelLayer):
|
|||
@classmethod
|
||||
def make(cls, ctx: context.Context, send_connect: bool) -> tunnel.LayerStack:
|
||||
spec = ctx.server.via
|
||||
assert spec
|
||||
assert spec.scheme in ("http", "https")
|
||||
|
||||
http_proxy = connection.Server(spec.address)
|
||||
|
|
|
@ -45,9 +45,8 @@ def test_simple():
|
|||
f = tflow.tflow()
|
||||
f.mode = "transparent"
|
||||
up.requestheaders(f)
|
||||
assert "proxy-authorization" in f.request.headers
|
||||
assert "authorization" in f.request.headers
|
||||
|
||||
f = tflow.tflow()
|
||||
f.mode = "upstream"
|
||||
up.http_connect(f)
|
||||
up.http_connect_upstream(f)
|
||||
assert "proxy-authorization" in f.request.headers
|
||||
|
|
|
@ -266,3 +266,8 @@ def test_layer_stack(tctx):
|
|||
stack /= b
|
||||
assert stack[0] == a
|
||||
assert a.child_layer is b
|
||||
|
||||
stack2 = tunnel.LayerStack()
|
||||
stack2 /= TChildLayer(tctx)
|
||||
stack2 /= stack
|
||||
assert stack2[0].child_layer is a # type: ignore
|
||||
|
|
|
@ -11,7 +11,7 @@ def test_mitmweb(event_loop, tdata):
|
|||
main.mitmweb([
|
||||
"--no-web-open-browser",
|
||||
"-s", tdata.path(shutdown_script),
|
||||
"-q", "-p", "0",
|
||||
"-q", "-p", "0", "--web-port", "0",
|
||||
])
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue