def setUp(self): super(ChatClientTestAsync, self).setUp() self.recording_processors.extend([ BodyReplacerProcessor(keys=[ "id", "token", "createdBy", "participants", "multipleStatus", "value" ]), URIIdentityReplacer(), ResponseReplacerProcessor(keys=[self._resource_name]), ChatURIReplacer() ]) endpoint, _ = parse_connection_str(self.connection_str) self.endpoint = endpoint self.identity_client = CommunicationIdentityClient.from_connection_string( self.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))
def setUp(self): super(CommunicationRelayClientTestAsync, self).setUp() self.recording_processors.extend([ BodyReplacerProcessor( keys=["id", "token", "username", "credential"]), URIIdentityReplacer() ])
def setUp(self): super(ChatThreadClientTestAsync, self).setUp() self.recording_processors.extend([ BodyReplacerProcessor(keys=[ "id", "token", "senderId", "chatMessageId", "nextLink", "members", "multipleStatus", "value" ]), URIIdentityReplacer(), ResponseReplacerProcessor(keys=[self._resource_name]), ChatURIReplacer() ]) endpoint, _ = parse_connection_str(self.connection_str) self.endpoint = endpoint self.identity_client = CommunicationIdentityClient.from_connection_string( self.connection_str) # create user self.user = self.identity_client.create_user() token_response = self.identity_client.issue_token(self.user, scopes=["chat"]) self.token = token_response.token # create another user self.new_user = self.identity_client.create_user() # create ChatClient self.chat_client = ChatClient(self.endpoint, CommunicationUserCredential(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 self.chat_client = ChatClient(self.endpoint, CommunicationTokenCredential(self.token)) self.chat_client_new_user = ChatClient(self.endpoint, CommunicationTokenCredential(self.token_new_user))
def setUp(self): super(ChatClientTest, self).setUp() self.recording_processors.extend([ BodyReplacerProcessor(keys=[ "id", "token", "createdBy", "members", "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.issue_token(self.user, scopes=["chat"]) self.token = tokenresponse.token # create ChatClient refresh_options = CommunicationTokenRefreshOptions(self.token) self.chat_client = ChatClient( self.endpoint, CommunicationTokenCredential(refresh_options))
def setUp(self): super(ChatThreadClientTestAsync, self).setUp() self.recording_processors.extend([ BodyReplacerProcessor(keys=["id", "token", "senderId", "chatMessageId", "nextLink", "participants", "multipleStatus", "value"]), URIIdentityReplacer(), ResponseReplacerProcessor(keys=[self._resource_name]), ChatURIReplacer()]) endpoint, _ = parse_connection_str(self.connection_str) self.endpoint = endpoint self.identity_client = CommunicationIdentityClient.from_connection_string(self.connection_str) self.users = [] self.user_tokens = [] self.chat_clients = [] # create user 1 self.user = self.identity_client.create_user() token_response = self.identity_client.get_token(self.user, scopes=["chat"]) self.token = token_response.token # create user 2 self.new_user = self.identity_client.create_user() token_response = self.identity_client.get_token(self.new_user, scopes=["chat"]) self.token_new_user = token_response.token # create ChatClient refresh_option = CommunicationTokenRefreshOptions(self.token) refresh_option_new_user = CommunicationTokenRefreshOptions(self.token_new_user) self.chat_client = ChatClient(self.endpoint, CommunicationTokenCredential(refresh_option)) self.chat_client_new_user = ChatClient(self.endpoint, CommunicationTokenCredential(refresh_option_new_user))
def setUp(self): super(CommunicationIdentityClientTest, self).setUp() self.recording_processors.extend([ BodyReplacerProcessor(keys=["id", "token"]), URIIdentityReplacer() ]) self.identity_client = CommunicationIdentityClient.from_connection_string( self.connection_str)
def setUp(self): super(SMSClientTestAsync, self).setUp() if self.is_playback(): self.phone_number = "+14255550123" self.recording_processors.extend([ BodyReplacerProcessor(keys=[ "to", "from", "messageId", "repeatabilityRequestId", "repeatabilityFirstSent" ]) ]) else: self.phone_number = os.getenv("AZURE_PHONE_NUMBER") self.recording_processors.extend([ BodyReplacerProcessor(keys=[ "to", "from", "messageId", "repeatabilityRequestId", "repeatabilityFirstSent" ]), ResponseReplacerProcessor(keys=[self._resource_name]) ])
def setUp(self): super(SMSClientTestAsync, self).setUp() if self.is_playback(): self.phone_number = "+18000005555" else: self.phone_number = os.getenv("PHONE_NUMBER") self.recording_processors.extend([ BodyReplacerProcessor(keys=["to", "from", "messageId"]), ResponseReplacerProcessor(keys=[self._resource_name])])
def setUp(self): super(PhoneNumbersClientTest, self).setUp() if self.is_playback(): self.phone_number = "sanitized" self.country_code = "US" else: self.phone_number = os.getenv("AZURE_COMMUNICATION_SERVICE_PHONE_NUMBER") self.country_code = os.getenv("AZURE_COMMUNICATION_SERVICE_COUNTRY_CODE", "US") self.phone_number_client = PhoneNumbersClient.from_connection_string(self.connection_str) self.recording_processors.extend([ BodyReplacerProcessor( keys=["id", "token", "phoneNumber"] ), PhoneNumberUriReplacer(), ResponseReplacerProcessor()])
def setUp(self): super(SMSClientTest, self).setUp() if self.is_playback(): self.phone_number = "+18000005555" else: self.phone_number = os.getenv( "AZURE_COMMUNICATION_SERVICE_PHONE_NUMBER") self.recording_processors.extend([ BodyReplacerProcessor(keys=["to", "from", "messageId"]), ResponseReplacerProcessor(keys=[self._resource_name]) ]) self.sms_client = SmsClient.from_connection_string(self.connection_str)
def setUp(self): super(PhoneNumbersClientTestAsync, self).setUp() if self.is_playback(): self.phone_number = "sanitized" self.country_code = "US" else: self.phone_number = get_test_phone_number() self.country_code = os.getenv( "AZURE_COMMUNICATION_SERVICE_COUNTRY_CODE", "US") self.phone_number_client = PhoneNumbersClient.from_connection_string( self.connection_str, http_logging_policy=get_http_logging_policy(), headers_policy=get_header_policy()) self.recording_processors.extend([ BodyReplacerProcessor( keys=["id", "token", "phoneNumber", "searchId"]), PhoneNumberUriReplacer(), ResponseReplacerProcessor() ])
def setUp(self): super(CommunicationIdentityClientTest, self).setUp() self.recording_processors.extend([ BodyReplacerProcessor(keys=["id", "token"]), URIIdentityReplacer() ])
def setUp(self): super(PhoneNumberAdministrationClientTest, self).setUp() self.recording_processors.extend([ BodyReplacerProcessor(keys=[ "id", "token", "capabilitiesUpdateId", "phoneNumber", "phonePlanIds", "phoneNumberCapabilitiesUpdates", "releaseId", "phoneNumberReleaseStatusDetails", "searchId", "phoneNumbers", "entities", "phonePlanGroups", "phonePlans", "phoneNumberCapabilitiesUpdate" ]), PhoneNumberUriReplacer() ]) self._phone_number_administration_client = PhoneNumberAdministrationClient.from_connection_string( self.connection_str) if self.is_live: self.country_code = os.getenv( 'AZURE_COMMUNICATION_SERVICE_PHONENUMBERS_COUNTRY_CODE') self.locale = os.getenv( 'AZURE_COMMUNICATION_SERVICE_PHONENUMBERS_LOCALE') self.phone_plan_group_id = os.getenv( 'AZURE_COMMUNICATION_SERVICE_PHONENUMBERS_PHONE_PLAN_GROUP_ID') self.phone_plan_id = os.getenv( 'AZURE_COMMUNICATION_SERVICE_PHONENUMBERS_PHONE_PLAN_ID') self.phone_plan_id_area_codes = os.getenv( 'AZURE_COMMUNICATION_SERVICE_PHONENUMBERS_PHONE_PLAN_ID_AREA_CODES' ) self.area_code_for_reservation = os.getenv( 'AZURE_COMMUNICATION_SERVICE_PHONENUMBERS_AREA_CODE_FOR_RESERVATION' ) self.reservation_id = os.getenv( 'AZURE_COMMUNICATION_SERVICE_PHONENUMBERS_RESERVATION_ID') self.reservation_id_to_purchase = os.getenv( 'AZURE_COMMUNICATION_SERVICE_PHONENUMBERS_RESERVATION_ID_TO_PURCHASE' ) self.reservation_id_to_cancel = os.getenv( 'AZURE_COMMUNICATION_SERVICE_PHONENUMBERS_RESERVATION_ID_TO_CANCEL' ) self.phonenumber_to_configure = os.getenv( 'AZURE_COMMUNICATION_SERVICE_PHONENUMBERS_PHONENUMBER_TO_CONFIGURE' ) self.phonenumber_to_get_config = os.getenv( 'AZURE_COMMUNICATION_SERVICE_PHONENUMBERS_PHONENUMBER_TO_GET_CONFIG' ) self.phonenumber_to_unconfigure = os.getenv( 'AZURE_COMMUNICATION_SERVICE_PHONENUMBERS_PHONENUMBER_TO_UNCONFIGURE' ) self.phonenumber_for_capabilities = os.getenv( 'AZURE_COMMUNICATION_SERVICE_PHONENUMBERS_PHONENUMBER_FOR_CAPABILITIES' ) self.phonenumber_to_release = os.getenv( 'AZURE_COMMUNICATION_SERVICE_PHONENUMBERS_PHONENUMBER_TO_RELEASE' ) self.capabilities_id = os.getenv( 'AZURE_COMMUNICATION_SERVICE_PHONENUMBERS_CAPABILITIES_ID') self.release_id = os.getenv( 'AZURE_COMMUNICATION_SERVICE_PHONENUMBERS_RELEASE_ID') self.scrubber.register_name_pair(self.phone_plan_group_id, "phone_plan_group_id") self.scrubber.register_name_pair(self.phone_plan_id, "phone_plan_id") self.scrubber.register_name_pair(self.phone_plan_id_area_codes, "phone_plan_id_area_codes") self.scrubber.register_name_pair(self.area_code_for_reservation, "area_code_for_reservation") self.scrubber.register_name_pair(self.reservation_id, "reservation_id") self.scrubber.register_name_pair(self.reservation_id_to_purchase, "reservation_id_to_purchase") self.scrubber.register_name_pair(self.reservation_id_to_cancel, "reservation_id_to_cancel") self.scrubber.register_name_pair(self.phonenumber_to_configure, "phonenumber_to_configure") self.scrubber.register_name_pair(self.phonenumber_to_get_config, "phonenumber_to_get_config") self.scrubber.register_name_pair(self.phonenumber_to_unconfigure, "phonenumber_to_unconfigure") self.scrubber.register_name_pair(self.phonenumber_for_capabilities, "phonenumber_for_capabilities") self.scrubber.register_name_pair(self.phonenumber_to_release, "phonenumber_to_release") self.scrubber.register_name_pair(self.capabilities_id, "capabilities_id") self.scrubber.register_name_pair(self.release_id, "release_id") else: self.connection_str = "endpoint=https://sanitized.communication.azure.com/;accesskey=fake===" self.country_code = "US" self.locale = "en-us" self.phone_plan_group_id = "phone_plan_group_id" self.phone_plan_id = "phone_plan_id" self.phone_plan_id_area_codes = "phone_plan_id_area_codes" self.area_code_for_reservation = "area_code_for_reservation" self.reservation_id = "reservation_id" self.reservation_id_to_purchase = "reservation_id_to_purchase" self.reservation_id_to_cancel = "reservation_id_to_cancel" self.phonenumber_to_configure = "phonenumber_to_configure" self.phonenumber_to_get_config = "phonenumber_to_get_config" self.phonenumber_to_unconfigure = "phonenumber_to_unconfigure" self.phonenumber_for_capabilities = "phonenumber_for_capabilities" self.phonenumber_to_release = "phonenumber_to_release" self.capabilities_id = "capabilities_id" self.release_id = "release_id"