def update_message(self): from azure.communication.chat import ChatThreadClient from azure.communication.chat import CommunicationTokenCredential, CommunicationTokenRefreshOptions refresh_options = CommunicationTokenRefreshOptions(self.token) chat_thread_client = ChatThreadClient(self.endpoint, CommunicationTokenCredential(refresh_options), self._thread_id) # [START update_message] content = "updated content" chat_thread_client.update_message(self._message_id, content=content) # [END update_message] print("update_chat_message succeeded")
def update_message(self): from azure.communication.chat import ChatThreadClient from azure.communication.chat import CommunicationUserCredential chat_thread_client = ChatThreadClient( self.endpoint, CommunicationUserCredential(self.token), self._thread_id) # [START update_message] content = "updated content" chat_thread_client.update_message(self._message_id, content=content) # [END update_message] print("update_chat_message succeeded")
def test_update_message(self): thread_id = "19:[email protected]" message_id='1596823919339' raised = False def mock_send(*_, **__): return mock_response(status_code=200) chat_thread_client = ChatThreadClient("https://endpoint", TestChatThreadClient.credential, thread_id, transport=Mock(send=mock_send)) try: content = "updated message content" chat_thread_client.update_message(message_id, content=content) except: raised = True self.assertFalse(raised, 'Expected is no excpetion raised')