Test rejecting an RPC with server middleware.
()
| 2149 | |
| 2150 | |
| 2151 | def 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 | |
| 2173 | def test_middleware_mapping(): |
nothing calls this directly
no test coverage detected