def test_batch_annotate_images(self): # Setup Expected Response expected_response = {} expected_response = image_annotator_pb2.BatchAnnotateImagesResponse( **expected_response ) # Mock the API response channel = ChannelStub(responses=[expected_response]) patch = mock.patch("google.api_core.grpc_helpers.create_channel") with patch as create_channel: create_channel.return_value = channel client = vision_v1p2beta1.ImageAnnotatorClient() # Setup Request requests = [] response = client.batch_annotate_images(requests) assert expected_response == response assert len(channel.requests) == 1 expected_request = image_annotator_pb2.BatchAnnotateImagesRequest( requests=requests ) actual_request = channel.requests[0][1] assert expected_request == actual_request
def test_batch_annotate_images(self): # Setup Expected Response expected_response = {} expected_response = image_annotator_pb2.BatchAnnotateImagesResponse( **expected_response) # Mock the API response channel = ChannelStub(responses=[expected_response]) client = vision_v1p2beta1.ImageAnnotatorClient(channel=channel) # Setup Request requests = [] response = client.batch_annotate_images(requests) assert expected_response == response assert len(channel.requests) == 1 expected_request = image_annotator_pb2.BatchAnnotateImagesRequest( requests=requests) actual_request = channel.requests[0][1] assert expected_request == actual_request