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

Function test_middleware_reject

python/pyarrow/tests/test_flight.py:2151–2170  ·  view source on GitHub ↗

Test rejecting an RPC with server middleware.

()

Source from the content-addressed store, hash-verified

2149
2150
2151def test_middleware_reject():
2152 """Test rejecting an RPC with server middleware."""
2153 with HeaderFlightServer(middleware={
2154 "test": SelectiveAuthServerMiddlewareFactory(),
2155 }) as server, \
2156 FlightClient(('localhost', server.port)) as client:
2157 # The middleware allows this through without auth.
2158 with pytest.raises(pa.ArrowNotImplementedError):
2159 list(client.list_actions())
2160
2161 # But not anything else.
2162 with pytest.raises(flight.FlightUnauthenticatedError):
2163 list(client.do_action(flight.Action(b"", b"")))
2164
2165 client = FlightClient(
2166 ('localhost', server.port),
2167 middleware=[SelectiveAuthClientMiddlewareFactory()]
2168 )
2169 response = next(client.do_action(flight.Action(b"", b"")))
2170 assert b"password" == response.body.to_pybytes()
2171
2172
2173def 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