Restore rolls back to a backup; a session can only file issues in another project #220
+5
-6
@@ -50,9 +50,10 @@ def _app() -> Quart:
|
||||
|
||||
|
||||
def _context(app, headers=None, scheme="http"):
|
||||
# Quart's ASGI layer writes the socket peer into a Remote-Addr header,
|
||||
# replacing any the client sent; a test request context takes it as given.
|
||||
return app.test_request_context(
|
||||
"/", headers=headers or {}, scheme=scheme,
|
||||
scope_base={"client": (PEER, 40000)},
|
||||
"/", headers={"Remote-Addr": PEER, **(headers or {})}, scheme=scheme,
|
||||
)
|
||||
|
||||
|
||||
@@ -76,10 +77,8 @@ async def test_no_header_reads_the_socket_peer(monkeypatch):
|
||||
|
||||
async def test_a_header_sent_twice_is_read_as_one_chain(monkeypatch):
|
||||
monkeypatch.setattr(Config, "TRUSTED_PROXY_HOPS", 1)
|
||||
headers = [("X-Forwarded-For", FORGED), ("X-Forwarded-For", CLIENT)]
|
||||
async with _app().test_request_context(
|
||||
"/", headers=headers, scope_base={"client": (PEER, 40000)},
|
||||
):
|
||||
headers = [("Remote-Addr", PEER), ("X-Forwarded-For", FORGED), ("X-Forwarded-For", CLIENT)]
|
||||
async with _app().test_request_context("/", headers=headers):
|
||||
assert client_ip() == CLIENT
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user