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(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(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"