Python: grpcio-testing support for server interceptors
- Dominant language
- C++
- Stars
- 45.3k
- Forks
- 11.4k
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 47
Description
### Is your feature request related to a problem? Please describe.
As far as I can tell, unit testing a gRPC server with its interceptors is not possible.
**This leads to 2 issues :**
- It is not possible to unit test servers which **require** that a specific interceptor exists (e.g. transforming the input query)
- [Possibly wrong] It is not possible to unit test the interceptors themselves
The root cause seems to be that it is not possible to pass an `interceptors` param to a test gRPC server (e.g. `grpc_testing.server_from_dictionary`) - in the same way we can with "true" gRPC Python servers (e.g. `grpc.server`).
### Describe the solution you'd like
Be able to pass an `interceptors` params to a test gRPC server.
### Describe alternatives you've considered
- Replace interceptors with decorators, at least for unit tests -> leads to code complexity
- Not use grpcio-testing and call methods implementing RPCs directly -> Less test coverage (no gRPC level testing)
Contributor guide
Assessment
This issue has not been assessed yet.