/ justapi / tests / test_grpc_client.py
swadhinbiswas test: add end-to-end integration test suite with gRPC and proto stubs · 7/9/2026
43e015f
13 lines · 421 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
import grpc
from tests.proto.gen import helloworld_pb2, helloworld_pb2_grpc

def run():
    with grpc.insecure_channel('127.0.0.1:50051') as channel:
        stub = helloworld_pb2_grpc.GreeterStub(channel)
        print("Calling SayHello...")
        response = stub.SayHello(helloworld_pb2.HelloRequest(name='JustAPI'))
        print("Greeter client received: " + response.message)

if __name__ == '__main__':
    run()