def test_create_client_event(self):
        # Setup Expected Response
        request_id = 'requestId37109963'
        event_id = 'eventId278118624'
        event_notes = 'eventNotes445073628'
        expected_response = {
            'request_id': request_id,
            'event_id': event_id,
            'event_notes': event_notes
        }
        expected_response = event_pb2.ClientEvent(**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 = talent_v4beta1.EventServiceClient()

        # Setup Request
        parent = client.tenant_path('[PROJECT]', '[TENANT]')
        client_event = {}

        response = client.create_client_event(parent, client_event)
        assert expected_response == response

        assert len(channel.requests) == 1
        expected_request = event_service_pb2.CreateClientEventRequest(
            parent=parent, client_event=client_event)
        actual_request = channel.requests[0][1]
        assert expected_request == actual_request
    def test_create_client_event(self):
        # Setup Expected Response
        request_id = "requestId37109963"
        event_id = "eventId278118624"
        expected_response = {"request_id": request_id, "event_id": event_id}
        expected_response = event_pb2.ClientEvent(**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 = talent_v4beta1.EventServiceClient()

        # Setup Request
        parent = client.project_path("[PROJECT]")
        client_event = {}

        response = client.create_client_event(parent, client_event)
        assert expected_response == response

        assert len(channel.requests) == 1
        expected_request = event_service_pb2.CreateClientEventRequest(
            parent=parent, client_event=client_event)
        actual_request = channel.requests[0][1]
        assert expected_request == actual_request
    def create_client_event(
        self,
        parent,
        client_event,
        retry=google.api_core.gapic_v1.method.DEFAULT,
        timeout=google.api_core.gapic_v1.method.DEFAULT,
        metadata=None,
    ):
        """
        Report events issued when end user interacts with customer's application
        that uses Cloud Talent Solution. You may inspect the created events in
        `self service
        tools <https://console.cloud.google.com/talent-solution/overview>`__.
        `Learn
        more <https://cloud.google.com/talent-solution/docs/management-tools>`__
        about self service tools.

        Example:
            >>> from google.cloud import talent_v4beta1
            >>>
            >>> client = talent_v4beta1.EventServiceClient()
            >>>
            >>> parent = client.project_path('[PROJECT]')
            >>>
            >>> # TODO: Initialize `client_event`:
            >>> client_event = {}
            >>>
            >>> response = client.create_client_event(parent, client_event)

        Args:
            parent (str): Parent project name.
            client_event (Union[dict, ~google.cloud.talent_v4beta1.types.ClientEvent]): Required.

                Events issued when end user interacts with customer's application that
                uses Cloud Talent Solution.

                If a dict is provided, it must be of the same form as the protobuf
                message :class:`~google.cloud.talent_v4beta1.types.ClientEvent`
            retry (Optional[google.api_core.retry.Retry]):  A retry object used
                to retry requests. If ``None`` is specified, requests will not
                be retried.
            timeout (Optional[float]): The amount of time, in seconds, to wait
                for the request to complete. Note that if ``retry`` is
                specified, the timeout applies to each individual attempt.
            metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
                that is provided to the method.

        Returns:
            A :class:`~google.cloud.talent_v4beta1.types.ClientEvent` instance.

        Raises:
            google.api_core.exceptions.GoogleAPICallError: If the request
                    failed for any reason.
            google.api_core.exceptions.RetryError: If the request failed due
                    to a retryable error and retry attempts failed.
            ValueError: If the parameters are invalid.
        """
        # Wrap the transport method to add retry and timeout logic.
        if "create_client_event" not in self._inner_api_calls:
            self._inner_api_calls[
                "create_client_event"] = google.api_core.gapic_v1.method.wrap_method(
                    self.transport.create_client_event,
                    default_retry=self._method_configs["CreateClientEvent"].
                    retry,
                    default_timeout=self._method_configs["CreateClientEvent"].
                    timeout,
                    client_info=self._client_info,
                )

        request = event_service_pb2.CreateClientEventRequest(
            parent=parent, client_event=client_event)
        return self._inner_api_calls["create_client_event"](request,
                                                            retry=retry,
                                                            timeout=timeout,
                                                            metadata=metadata)