def test_StatusQuery(grpc_channel): from Testing_protos import Add_One_pb2_grpc from Testing_protos import AddTypes_pb2 stub = Add_One_pb2_grpc.AdditionStub(grpc_channel) response = stub.Status(AddTypes_pb2.StatusQuery(state={})) assert response.state.states[ "sum_engine"].state == AddTypes_pb2.ServiceState.READY assert AddTypes_pb2.ServiceState.Name( response.state.states["difference_engine"].state ) == "BUSY_COMPUTING_ONE" assert response.state.states["chaos_engine"].state == AddTypes_pb2._UNKNOWN
def main(): with grpc.insecure_channel("localhost:19001") as channel: stub = Add_One_pb2_grpc.AdditionStub(channel) response = stub.AddOne(AddTypes_pb2.Addend(number=5)) print(response) responses = stub.AddOnes(AddTypes_pb2.Addend(number=5)) print(*responses) response = stub.AddsOne( (AddTypes_pb2.Addend(number=x) for x in range(5))) print(response) responses = stub.AddsOnes( (AddTypes_pb2.Addend(number=x) for x in range(5))) print(*responses) response = stub.Status(AddTypes_pb2.StatusQuery(count={})) print(response) response = stub.Status(AddTypes_pb2.StatusQuery(state={})) print(response)
def test_CountQuery(grpc_channel): from Testing_protos import Add_One_pb2_grpc from Testing_protos import AddTypes_pb2 stub = Add_One_pb2_grpc.AdditionStub(grpc_channel) response = stub.Status(AddTypes_pb2.StatusQuery(count={})) assert response.count.number > 0