def setUp(self): super(ChatClientTest, self).setUp() self.recording_processors.extend([ BodyReplacerProcessor(keys=[ "id", "token", "createdBy", "participants", "multipleStatus", "value" ]), URIIdentityReplacer(), ChatURIReplacer() ]) self.identity_client = CommunicationIdentityClient.from_connection_string( self.connection_str) endpoint, _ = parse_connection_str(self.connection_str) self.endpoint = endpoint # create user and issue token self.user = self.identity_client.create_user() tokenresponse = self.identity_client.get_token(self.user, scopes=["chat"]) self.token = tokenresponse.token # create ChatClient self.chat_client = ChatClient(self.endpoint, CommunicationTokenCredential(self.token))
def setUp(self): super(ChatThreadClientTest, self).setUp() self.recording_processors.extend([ BodyReplacerProcessor(keys=["id", "token", "senderId", "chatMessageId", "nextLink", "participants", "multipleStatus", "value"]), URIIdentityReplacer(), ChatURIReplacer()]) self.identity_client = CommunicationIdentityClient.from_connection_string( self.connection_str) endpoint, _ = parse_connection_str(self.connection_str) self.endpoint = endpoint # create user and issue token self.user = self.identity_client.create_user() tokenresponse = self.identity_client.get_token(self.user, scopes=["chat"]) self.token = tokenresponse.token # create another user self.new_user = self.identity_client.create_user() tokenresponse = self.identity_client.get_token(self.new_user, scopes=["chat"]) self.token_new_user = tokenresponse.token # create ChatClient refresh_options = CommunicationTokenRefreshOptions(self.token) refresh_options_new_user = CommunicationTokenRefreshOptions(self.token_new_user) self.chat_client = ChatClient(self.endpoint, CommunicationTokenCredential(refresh_options)) self.chat_client_new_user = ChatClient(self.endpoint, CommunicationTokenCredential(refresh_options_new_user))
def setUp(self): super(CommunicationTestCase, self).setUp() if self.is_playback(): self.connection_str = "endpoint=https://sanitized/;accesskey=fake===" else: self.connection_str = os.getenv('COMMUNICATION_CONNECTION_STRING') endpoint, _ = parse_connection_str(self.connection_str) self._resource_name = endpoint.split(".")[0] self.scrubber.register_name_pair(self._resource_name, "sanitized")