def METHOD_NAME(self):
    connection_str = get_connection_str()
    endpoint, _ = parse_connection_str(connection_str)
    self.endpoint = endpoint
    self.identity_client = CommunicationIdentityClient.from_connection_string(connection_str)
    # create user
    self.user = self.identity_client.create_user()
    token_response = self.identity_client.get_token(self.user, scopes=["chat"])
    self.token = token_response.token
    # create ChatClient
    self.chat_client = ChatClient(
        self.endpoint, 
        CommunicationTokenCredential(self.token), 
        http_logging_policy=get_http_logging_policy()
    )