|
|
|
@ -21,6 +21,7 @@ import grpc_testing |
|
|
|
|
from tests.testing import _application_common |
|
|
|
|
from tests.testing import _application_testing_common |
|
|
|
|
from tests.testing import _server_application |
|
|
|
|
from tests.testing.proto import services_pb2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class FirstServiceServicerTest(unittest.TestCase): |
|
|
|
@ -94,6 +95,30 @@ class FirstServiceServicerTest(unittest.TestCase): |
|
|
|
|
response) |
|
|
|
|
self.assertIs(code, grpc.StatusCode.OK) |
|
|
|
|
|
|
|
|
|
def test_mutating_stream_stream(self): |
|
|
|
|
rpc = self._real_time_server.invoke_stream_stream( |
|
|
|
|
_application_testing_common.FIRST_SERVICE_STRESTRE, (), None) |
|
|
|
|
rpc.send_request(_application_common.STREAM_STREAM_MUTATING_REQUEST) |
|
|
|
|
initial_metadata = rpc.initial_metadata() |
|
|
|
|
responses = [ |
|
|
|
|
rpc.take_response() |
|
|
|
|
for _ in range(_application_common.STREAM_STREAM_MUTATING_COUNT) |
|
|
|
|
] |
|
|
|
|
rpc.send_request(_application_common.STREAM_STREAM_MUTATING_REQUEST) |
|
|
|
|
responses.extend([ |
|
|
|
|
rpc.take_response() |
|
|
|
|
for _ in range(_application_common.STREAM_STREAM_MUTATING_COUNT) |
|
|
|
|
]) |
|
|
|
|
rpc.requests_closed() |
|
|
|
|
_, _, _ = rpc.termination() |
|
|
|
|
expected_responses = ( |
|
|
|
|
services_pb2.Bottom(first_bottom_field=0), |
|
|
|
|
services_pb2.Bottom(first_bottom_field=1), |
|
|
|
|
services_pb2.Bottom(first_bottom_field=0), |
|
|
|
|
services_pb2.Bottom(first_bottom_field=1), |
|
|
|
|
) |
|
|
|
|
self.assertSequenceEqual(expected_responses, responses) |
|
|
|
|
|
|
|
|
|
def test_server_rpc_idempotence(self): |
|
|
|
|
rpc = self._real_time_server.invoke_unary_unary( |
|
|
|
|
_application_testing_common.FIRST_SERVICE_UNUN, (), |
|
|
|
|