14 """Conducts interop tests locally."""
22 from src.proto.grpc.testing
import test_pb2_grpc
28 _SERVER_HOST_OVERRIDE =
'foo.test.google.fr'
34 This class must be mixed in with unittest.TestCase and a class that defines
35 setUp and tearDown methods that manage a stub attribute.
37 _stub: test_pb2_grpc.TestServiceStub
40 await methods.test_interoperability(methods.TestCase.EMPTY_UNARY,
43 async
def test_large_unary(self):
44 await methods.test_interoperability(methods.TestCase.LARGE_UNARY,
48 await methods.test_interoperability(methods.TestCase.SERVER_STREAMING,
52 await methods.test_interoperability(methods.TestCase.CLIENT_STREAMING,
56 await methods.test_interoperability(methods.TestCase.PING_PONG,
59 async
def test_cancel_after_begin(self):
60 await methods.test_interoperability(methods.TestCase.CANCEL_AFTER_BEGIN,
63 async
def test_cancel_after_first_response(self):
64 await methods.test_interoperability(
65 methods.TestCase.CANCEL_AFTER_FIRST_RESPONSE, self._stub,
None)
67 async
def test_timeout_on_sleeping_server(self):
68 await methods.test_interoperability(
69 methods.TestCase.TIMEOUT_ON_SLEEPING_SERVER, self._stub,
None)
71 async
def test_empty_stream(self):
72 await methods.test_interoperability(methods.TestCase.EMPTY_STREAM,
75 async
def test_status_code_and_message(self):
76 await methods.test_interoperability(
77 methods.TestCase.STATUS_CODE_AND_MESSAGE, self._stub,
None)
79 async
def test_unimplemented_method(self):
80 await methods.test_interoperability(
81 methods.TestCase.UNIMPLEMENTED_METHOD, self._stub,
None)
83 async
def test_unimplemented_service(self):
84 await methods.test_interoperability(
85 methods.TestCase.UNIMPLEMENTED_SERVICE, self._stub,
None)
87 async
def test_custom_metadata(self):
88 await methods.test_interoperability(methods.TestCase.CUSTOM_METADATA,
91 async
def test_special_status_message(self):
92 await methods.test_interoperability(
93 methods.TestCase.SPECIAL_STATUS_MESSAGE, self._stub,
None)
103 async
def tearDown(self):
112 (resources.private_key(), resources.certificate_chain())
115 resources.test_root_certificates())
117 'grpc.ssl_target_name_override',
118 _SERVER_HOST_OVERRIDE,
122 secure=
True, server_credentials=server_credentials)
123 self.
_channel = aio.secure_channel(address, channel_credentials,
127 async
def tearDown(self):
132 if __name__ ==
'__main__':
133 logging.basicConfig(level=logging.INFO)
134 unittest.main(verbosity=2)