def testCancelledStreamRequestStreamResponse(self): for name, test_messages_sequence in (six.iteritems( self.digest.stream_stream_messages_sequences)): for unused_test_messages in test_messages_sequence: callback = testing_callback.Callback() call, unused_request_consumer = self.stub.event_stream_in_stream_out( name, callback, callback.abort, test_constants.SHORT_TIMEOUT) call.cancel() callback.block_until_terminated() self.assertEqual(interfaces.Abortion.CANCELLED, callback.abortion())
def testCancelledUnaryRequestStreamResponse(self): for name, test_messages_sequence in ( self.digest.unary_stream_messages_sequences.iteritems()): for test_messages in test_messages_sequence: request = test_messages.request() callback = testing_callback.Callback() call = self.stub.event_value_in_stream_out( name, request, callback, callback.abort, test_constants.SHORT_TIMEOUT) call.cancel() callback.block_until_terminated() self.assertEqual(interfaces.Abortion.CANCELLED, callback.abortion())
def testFailedUnaryRequestStreamResponse(self): for name, test_messages_sequence in ( self.digest.unary_stream_messages_sequences.iteritems()): for test_messages in test_messages_sequence: request = test_messages.request() callback = testing_callback.Callback() with self.control.fail(): self.stub.event_value_in_stream_out( name, request, callback, callback.abort, test_constants.SHORT_TIMEOUT) callback.block_until_terminated() self.assertEqual(interfaces.Abortion.SERVICER_FAILURE, callback.abortion())
def testExpiredUnaryRequestUnaryResponse(self): for name, test_messages_sequence in ( self.digest.unary_unary_messages_sequences.iteritems()): for test_messages in test_messages_sequence: request = test_messages.request() callback = testing_callback.Callback() with self.control.pause(): self.stub.event_value_in_value_out( name, request, callback.complete, callback.abort, test_constants.SHORT_TIMEOUT) callback.block_until_terminated() self.assertEqual(interfaces.Abortion.EXPIRED, callback.abortion())
def testExpiredStreamRequestStreamResponse(self): for name, test_messages_sequence in ( self.digest.stream_stream_messages_sequences.iteritems()): for test_messages in test_messages_sequence: requests = test_messages.requests() callback = testing_callback.Callback() unused_call, request_consumer = self.stub.event_stream_in_stream_out( name, callback, callback.abort, test_constants.SHORT_TIMEOUT) for request in requests: request_consumer.consume(request) callback.block_until_terminated() self.assertEqual(interfaces.Abortion.EXPIRED, callback.abortion())
def testCancelledStreamRequestUnaryResponse(self): for name, test_messages_sequence in ( self.digest.stream_unary_messages_sequences.iteritems()): for test_messages in test_messages_sequence: requests = test_messages.requests() callback = testing_callback.Callback() call, request_consumer = self.stub.event_stream_in_value_out( name, callback.complete, callback.abort, test_constants.SHORT_TIMEOUT) for request in requests: request_consumer.consume(request) call.cancel() callback.block_until_terminated() self.assertEqual(interfaces.Abortion.CANCELLED, callback.abortion())
def testSuccessfulStreamRequestStreamResponse(self): for name, test_messages_sequence in ( self.digest.stream_stream_messages_sequences.iteritems()): for test_messages in test_messages_sequence: requests = test_messages.requests() callback = testing_callback.Callback() unused_call, request_consumer = self.stub.event_stream_in_stream_out( name, callback, callback.abort, test_constants.SHORT_TIMEOUT) for request in requests: request_consumer.consume(request) request_consumer.terminate() callback.block_until_terminated() responses = callback.responses() test_messages.verify(requests, responses, self)
def testFailedStreamRequestStreamResponse(self): for name, test_messages_sequence in ( self.digest.stream_stream_messages_sequences.iteritems()): for test_messages in test_messages_sequence: requests = test_messages.requests() callback = testing_callback.Callback() with self.control.fail(): unused_call, request_consumer = self.stub.event_stream_in_stream_out( name, callback, callback.abort, test_constants.SHORT_TIMEOUT) for request in requests: request_consumer.consume(request) request_consumer.terminate() callback.block_until_terminated() self.assertEqual(interfaces.Abortion.SERVICER_FAILURE, callback.abortion())