def test_async_batch_annotate_files(self):
        # Setup Expected Response
        expected_response = {}
        expected_response = image_annotator_pb2.AsyncBatchAnnotateFilesResponse(
            **expected_response)
        operation = operations_pb2.Operation(
            name='operations/test_async_batch_annotate_files', done=True)
        operation.response.Pack(expected_response)

        # Mock the API response
        channel = ChannelStub(responses=[operation])
        client = vision_v1p3beta1.ImageAnnotatorClient(channel=channel)

        # Setup Request
        requests = []

        response = client.async_batch_annotate_files(requests)
        result = response.result()
        assert expected_response == result

        assert len(channel.requests) == 1
        expected_request = image_annotator_pb2.AsyncBatchAnnotateFilesRequest(
            requests=requests)
        actual_request = channel.requests[0][1]
        assert expected_request == actual_request
    def test_async_batch_annotate_files(self):
        # Setup Expected Response
        expected_response = {}
        expected_response = image_annotator_pb2.AsyncBatchAnnotateFilesResponse(
            **expected_response)
        operation = operations_pb2.Operation(
            name='operations/test_async_batch_annotate_files', done=True)
        operation.response.Pack(expected_response)

        # Mock the API response
        channel = ChannelStub(responses=[operation])
        patch = mock.patch('google.api_core.grpc_helpers.create_channel')
        with patch as create_channel:
            create_channel.return_value = channel
            client = vision_v1p3beta1.ImageAnnotatorClient()

        # Setup Request
        requests = []

        response = client.async_batch_annotate_files(requests)
        result = response.result()
        assert expected_response == result

        assert len(channel.requests) == 1
        expected_request = image_annotator_pb2.AsyncBatchAnnotateFilesRequest(
            requests=requests)
        actual_request = channel.requests[0][1]
        assert expected_request == actual_request