Пример #1
0
    def test_list_members(self):
        thread_id = "19:[email protected]"
        member_id = "8:acs:57b9bac9-df6c-4d39-a73b-26e944adf6ea_9b0110-08007f1041"
        raised = False

        def mock_send(*_, **__):
            return mock_response(status_code=200,
                                 json_payload={"value": [{
                                     "id": member_id
                                 }]})

        chat_thread_client = ChatThreadClient("https://endpoint",
                                              TestChatThreadClient.credential,
                                              thread_id,
                                              transport=Mock(send=mock_send))

        chat_thread_members = None
        try:
            chat_thread_members = chat_thread_client.list_members()
        except:
            raised = True

        self.assertFalse(raised, 'Expected is no excpetion raised')
        for chat_thread_member_page in chat_thread_members.by_page():
            l = list(chat_thread_member_page)
            assert len(l) == 1
            l[0].user.id = member_id
Пример #2
0
 def list_members(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 list_members]
     chat_thread_members = chat_thread_client.list_members()
     print("list_chat_members succeeded, members: ")
     for chat_thread_member in chat_thread_members:
         print(chat_thread_member)
 def list_members(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 list_members]
     chat_thread_members = chat_thread_client.list_members()
     print("list_chat_members succeeded, members: ")
     for chat_thread_member in chat_thread_members:
         print(chat_thread_member)