MCPcopy Create free account
hub / github.com/apache/arrow / test_middleware_reject

Function test_middleware_reject

python/pyarrow/tests/test_flight.py:2113–2132  ·  view source on GitHub ↗

Test rejecting an RPC with server middleware.

()

Source from the content-addressed store, hash-verified

2111
2112
2113def test_middleware_reject():
2114 """Test rejecting an RPC with server middleware."""
2115 with HeaderFlightServer(middleware={
2116 "test": SelectiveAuthServerMiddlewareFactory(),
2117 }) as server, \
2118 FlightClient(('localhost', server.port)) as client:
2119 # The middleware allows this through without auth.
2120 with pytest.raises(pa.ArrowNotImplementedError):
2121 list(client.list_actions())
2122
2123 # But not anything else.
2124 with pytest.raises(flight.FlightUnauthenticatedError):
2125 list(client.do_action(flight.Action(b"", b"")))
2126
2127 client = FlightClient(
2128 ('localhost', server.port),
2129 middleware=[SelectiveAuthClientMiddlewareFactory()]
2130 )
2131 response = next(client.do_action(flight.Action(b"", b"")))
2132 assert b"password" == response.body.to_pybytes()
2133
2134
2135def test_middleware_mapping():

Callers

nothing calls this directly

Calls 7

FlightClientClass · 0.90
HeaderFlightServerClass · 0.85
listFunction · 0.85
list_actionsMethod · 0.45
do_actionMethod · 0.45

Tested by

no test coverage detected