def test_batch_update_intents(self): # Setup Expected Response expected_response = {} expected_response = intent_pb2.BatchUpdateIntentsResponse( **expected_response) operation = operations_pb2.Operation( name='operations/test_batch_update_intents', 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 = dialogflow_v2.IntentsClient() # Setup Request parent = client.project_agent_path('[PROJECT]') language_code = 'languageCode-412800396' response = client.batch_update_intents(parent, language_code) result = response.result() assert expected_response == result assert len(channel.requests) == 1 expected_request = intent_pb2.BatchUpdateIntentsRequest( parent=parent, language_code=language_code) actual_request = channel.requests[0][1] assert expected_request == actual_request
def test_batch_update_intents(self): # Setup Expected Response expected_response = {} expected_response = intent_pb2.BatchUpdateIntentsResponse( **expected_response) operation = operations_pb2.Operation( name='operations/test_batch_update_intents', done=True) operation.response.Pack(expected_response) # Mock the API response channel = ChannelStub(responses=[operation]) client = dialogflow_v2.IntentsClient(channel=channel) # Setup Request parent = client.agent_path('[PROJECT]', '[AGENT]') language_code = 'languageCode-412800396' response = client.batch_update_intents(parent, language_code) result = response.result() assert expected_response == result assert len(channel.requests) == 1 expected_request = intent_pb2.BatchUpdateIntentsRequest( parent=parent, language_code=language_code) actual_request = channel.requests[0][1] assert expected_request == actual_request
def test_batch_update_intents(self): # Setup Expected Response expected_response = {} expected_response = intent_pb2.BatchUpdateIntentsResponse(**expected_response) operation = operations_pb2.Operation( name="operations/test_batch_update_intents", 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 = dialogflow_v2.IntentsClient() # Setup Request parent = client.agent_path("[PROJECT]", "[AGENT]") response = client.batch_update_intents(parent) result = response.result() assert expected_response == result assert len(channel.requests) == 1 expected_request = intent_pb2.BatchUpdateIntentsRequest(parent=parent) actual_request = channel.requests[0][1] assert expected_request == actual_request