示例#1
0
    def update_topic(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_topic]
        topic = "updated thread topic"
        chat_thread_client.update_topic(topic=topic)
        # [END update_topic]

        print("update_chat_thread succeeded")
示例#2
0
    def test_update_topic(self):
        thread_id = "19:[email protected]"
        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))

        topic = "update topic"
        try:
            chat_thread_client.update_topic(topic=topic)
        except:
            raised = True

        self.assertFalse(raised, 'Expected is no excpetion raised')