def test_streaming_annotate_video(self):
        # Setup Expected Response
        annotation_results_uri = "annotationResultsUri-238075757"
        expected_response = {"annotation_results_uri": annotation_results_uri}
        expected_response = video_intelligence_pb2.StreamingAnnotateVideoResponse(
            **expected_response
        )

        # Mock the API response
        channel = ChannelStub(responses=[iter([expected_response])])
        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
        with patch as create_channel:
            create_channel.return_value = channel
            client = (
                videointelligence_v1p3beta1.StreamingVideoIntelligenceServiceClient()
            )

        # Setup Request
        request = {}
        request = video_intelligence_pb2.StreamingAnnotateVideoRequest(**request)
        requests = [request]

        response = client.streaming_annotate_video(requests)
        resources = list(response)
        assert len(resources) == 1
        assert expected_response == resources[0]

        assert len(channel.requests) == 1
        actual_requests = channel.requests[0][1]
        assert len(actual_requests) == 1
        actual_request = list(actual_requests)[0]
        assert request == actual_request
    def test_streaming_annotate_video_exception(self):
        # Mock the API response
        channel = ChannelStub(responses=[CustomException()])
        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
        with patch as create_channel:
            create_channel.return_value = channel
            client = (
                videointelligence_v1p3beta1.StreamingVideoIntelligenceServiceClient()
            )

        # Setup request
        request = {}

        request = video_intelligence_pb2.StreamingAnnotateVideoRequest(**request)
        requests = [request]

        with pytest.raises(CustomException):
            client.streaming_annotate_video(requests)