def remove_participant(self): from azure.communication.chat import ChatThreadClient from azure.communication.chat import CommunicationTokenCredential, CommunicationUserIdentifier, CommunicationTokenRefreshOptions refresh_options = CommunicationTokenRefreshOptions(self.token) chat_thread_client = ChatThreadClient(self.endpoint, CommunicationTokenCredential(refresh_options), self._thread_id) # [START remove_participant] chat_thread_client.remove_participant(self.new_user) # [END remove_participant] print("remove_chat_participant succeeded")
def test_remove_participant(self): thread_id = "19:[email protected]" participant_id="8:acs:57b9bac9-df6c-4d39-a73b-26e944adf6ea_9b0110-08007f1041" 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.remove_participant(user=CommunicationUserIdentifier(participant_id)) except: raised = True self.assertFalse(raised, 'Expected is no excpetion raised')