-
Notifications
You must be signed in to change notification settings - Fork 23
Open
Description
If I'm expecting a service to fail a request with a specific status code I'd like to assert that the correct StatusCode is returned by grpc.
After much digging here's a working example:
def test_GetUser(grpc_stub):
request = GetUserRequest()
with pytest.raises(grpc.RpcError) as e:
response = grpc_stub.GetUser(request)
assert e.value.code() == grpc.StatusCode.INVALID_ARGUMENTReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels