def delete_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 delete_message] chat_thread_client.delete_message(self._message_id) # [END delete_message] print("delete_chat_message succeeded")
def delete_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 delete_message] chat_thread_client.delete_message(self._message_id) # [END delete_message] print("delete_chat_message succeeded")
def test_delete_message(self): thread_id = "19:[email protected]" message_id='1596823919339' raised = False def mock_send(*_, **__): return mock_response(status_code=204) chat_thread_client = ChatThreadClient("https://endpoint", TestChatThreadClient.credential, thread_id, transport=Mock(send=mock_send)) try: chat_thread_client.delete_message(message_id) except: raised = True self.assertFalse(raised, 'Expected is no excpetion raised')