|
|
@ -22,7 +22,6 @@ from tests_aio.unit._test_server import start_test_server, UNARY_CALL_WITH_SLEEP |
|
|
|
from tests_aio.unit._test_base import AioTestBase |
|
|
|
from tests_aio.unit._test_base import AioTestBase |
|
|
|
from src.proto.grpc.testing import messages_pb2 |
|
|
|
from src.proto.grpc.testing import messages_pb2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_LOCAL_CANCEL_DETAILS_EXPECTATION = 'Locally cancelled by application!' |
|
|
|
_LOCAL_CANCEL_DETAILS_EXPECTATION = 'Locally cancelled by application!' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -234,8 +233,8 @@ class TestUnaryUnaryClientInterceptor(AioTestBase): |
|
|
|
interceptor, interceptor_response = Interceptor(), ResponseInterceptor() |
|
|
|
interceptor, interceptor_response = Interceptor(), ResponseInterceptor() |
|
|
|
|
|
|
|
|
|
|
|
async with aio.insecure_channel( |
|
|
|
async with aio.insecure_channel( |
|
|
|
self._server_target, interceptors=[interceptor, |
|
|
|
self._server_target, |
|
|
|
interceptor_response]) as channel: |
|
|
|
interceptors=[interceptor, interceptor_response]) as channel: |
|
|
|
|
|
|
|
|
|
|
|
multicallable = channel.unary_unary( |
|
|
|
multicallable = channel.unary_unary( |
|
|
|
'/grpc.testing.TestService/UnaryCall', |
|
|
|
'/grpc.testing.TestService/UnaryCall', |
|
|
@ -277,7 +276,6 @@ class TestInterceptedUnaryUnaryCall(AioTestBase): |
|
|
|
call = await continuation(client_call_details, request) |
|
|
|
call = await continuation(client_call_details, request) |
|
|
|
return call |
|
|
|
return call |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async with aio.insecure_channel(self._server_target, |
|
|
|
async with aio.insecure_channel(self._server_target, |
|
|
|
interceptors=[Interceptor() |
|
|
|
interceptors=[Interceptor() |
|
|
|
]) as channel: |
|
|
|
]) as channel: |
|
|
@ -307,7 +305,6 @@ class TestInterceptedUnaryUnaryCall(AioTestBase): |
|
|
|
await call |
|
|
|
await call |
|
|
|
return call |
|
|
|
return call |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async with aio.insecure_channel(self._server_target, |
|
|
|
async with aio.insecure_channel(self._server_target, |
|
|
|
interceptors=[Interceptor() |
|
|
|
interceptors=[Interceptor() |
|
|
|
]) as channel: |
|
|
|
]) as channel: |
|
|
@ -336,7 +333,6 @@ class TestInterceptedUnaryUnaryCall(AioTestBase): |
|
|
|
call = await continuation(client_call_details, request) |
|
|
|
call = await continuation(client_call_details, request) |
|
|
|
return call |
|
|
|
return call |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async with aio.insecure_channel(self._server_target, |
|
|
|
async with aio.insecure_channel(self._server_target, |
|
|
|
interceptors=[Interceptor() |
|
|
|
interceptors=[Interceptor() |
|
|
|
]) as channel: |
|
|
|
]) as channel: |
|
|
@ -346,7 +342,8 @@ class TestInterceptedUnaryUnaryCall(AioTestBase): |
|
|
|
request_serializer=messages_pb2.SimpleRequest.SerializeToString, |
|
|
|
request_serializer=messages_pb2.SimpleRequest.SerializeToString, |
|
|
|
response_deserializer=messages_pb2.SimpleResponse.FromString) |
|
|
|
response_deserializer=messages_pb2.SimpleResponse.FromString) |
|
|
|
|
|
|
|
|
|
|
|
call = multicallable(messages_pb2.SimpleRequest(), timeout=UNARY_CALL_WITH_SLEEP_VALUE / 2) |
|
|
|
call = multicallable(messages_pb2.SimpleRequest(), |
|
|
|
|
|
|
|
timeout=UNARY_CALL_WITH_SLEEP_VALUE / 2) |
|
|
|
|
|
|
|
|
|
|
|
with self.assertRaises(aio.AioRpcError) as exception_context: |
|
|
|
with self.assertRaises(aio.AioRpcError) as exception_context: |
|
|
|
await call |
|
|
|
await call |
|
|
@ -369,7 +366,6 @@ class TestInterceptedUnaryUnaryCall(AioTestBase): |
|
|
|
await call |
|
|
|
await call |
|
|
|
return call |
|
|
|
return call |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async with aio.insecure_channel(self._server_target, |
|
|
|
async with aio.insecure_channel(self._server_target, |
|
|
|
interceptors=[Interceptor() |
|
|
|
interceptors=[Interceptor() |
|
|
|
]) as channel: |
|
|
|
]) as channel: |
|
|
@ -379,7 +375,8 @@ class TestInterceptedUnaryUnaryCall(AioTestBase): |
|
|
|
request_serializer=messages_pb2.SimpleRequest.SerializeToString, |
|
|
|
request_serializer=messages_pb2.SimpleRequest.SerializeToString, |
|
|
|
response_deserializer=messages_pb2.SimpleResponse.FromString) |
|
|
|
response_deserializer=messages_pb2.SimpleResponse.FromString) |
|
|
|
|
|
|
|
|
|
|
|
call = multicallable(messages_pb2.SimpleRequest(), timeout=UNARY_CALL_WITH_SLEEP_VALUE / 2) |
|
|
|
call = multicallable(messages_pb2.SimpleRequest(), |
|
|
|
|
|
|
|
timeout=UNARY_CALL_WITH_SLEEP_VALUE / 2) |
|
|
|
|
|
|
|
|
|
|
|
with self.assertRaises(aio.AioRpcError) as exception_context: |
|
|
|
with self.assertRaises(aio.AioRpcError) as exception_context: |
|
|
|
await call |
|
|
|
await call |
|
|
@ -406,7 +403,6 @@ class TestInterceptedUnaryUnaryCall(AioTestBase): |
|
|
|
# This line should never be reached |
|
|
|
# This line should never be reached |
|
|
|
raise Exception() |
|
|
|
raise Exception() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async with aio.insecure_channel(self._server_target, |
|
|
|
async with aio.insecure_channel(self._server_target, |
|
|
|
interceptors=[Interceptor() |
|
|
|
interceptors=[Interceptor() |
|
|
|
]) as channel: |
|
|
|
]) as channel: |
|
|
@ -450,7 +446,6 @@ class TestInterceptedUnaryUnaryCall(AioTestBase): |
|
|
|
# This line should never be reached |
|
|
|
# This line should never be reached |
|
|
|
raise Exception() |
|
|
|
raise Exception() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async with aio.insecure_channel(self._server_target, |
|
|
|
async with aio.insecure_channel(self._server_target, |
|
|
|
interceptors=[Interceptor() |
|
|
|
interceptors=[Interceptor() |
|
|
|
]) as channel: |
|
|
|
]) as channel: |
|
|
@ -489,7 +484,6 @@ class TestInterceptedUnaryUnaryCall(AioTestBase): |
|
|
|
await call |
|
|
|
await call |
|
|
|
return call |
|
|
|
return call |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async with aio.insecure_channel(self._server_target, |
|
|
|
async with aio.insecure_channel(self._server_target, |
|
|
|
interceptors=[Interceptor() |
|
|
|
interceptors=[Interceptor() |
|
|
|
]) as channel: |
|
|
|
]) as channel: |
|
|
@ -521,7 +515,6 @@ class TestInterceptedUnaryUnaryCall(AioTestBase): |
|
|
|
call.cancel() |
|
|
|
call.cancel() |
|
|
|
return call |
|
|
|
return call |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async with aio.insecure_channel(self._server_target, |
|
|
|
async with aio.insecure_channel(self._server_target, |
|
|
|
interceptors=[Interceptor() |
|
|
|
interceptors=[Interceptor() |
|
|
|
]) as channel: |
|
|
|
]) as channel: |
|
|
|