async def test_purchase_phone_numbers_from_managed_identity(self): endpoint, access_key = parse_connection_str(self.connection_str) credential = create_token_credential() phone_number_client = PhoneNumbersClient( endpoint, credential, http_logging_policy=get_http_logging_policy()) capabilities = PhoneNumberCapabilities( calling=PhoneNumberCapabilityType.INBOUND, sms=PhoneNumberCapabilityType.INBOUND_OUTBOUND) async with phone_number_client: search_poller = await phone_number_client.begin_search_available_phone_numbers( self.country_code, PhoneNumberType.TOLL_FREE, PhoneNumberAssignmentType.APPLICATION, capabilities, polling=True) phone_number_to_buy = await search_poller.result() purchase_poller = await phone_number_client.begin_purchase_phone_numbers( phone_number_to_buy.search_id, polling=True) await purchase_poller.result() release_poller = await phone_number_client.begin_release_phone_number( phone_number_to_buy.phone_numbers[0]) assert release_poller.status( ) == PhoneNumberOperationStatus.SUCCEEDED.value
def test_list_all_phone_numbers_from_managed_identity(self): endpoint, access_key = parse_connection_str(self.connection_str) credential = create_token_credential() phone_number_client = PhoneNumbersAdministrationClient( endpoint, credential) pages = phone_number_client.list_all_phone_numbers() assert pages.next()
def test_get_purchased_phone_number_from_managed_identity(self): endpoint, access_key = parse_connection_str(self.connection_str) credential = create_token_credential() phone_number_client = PhoneNumbersClient(endpoint, credential) phone_number = phone_number_client.get_purchased_phone_number( self.phone_number) assert phone_number.phone_number == self.phone_number
def test_list_purchased_phone_numbers_from_managed_identity(self): endpoint, access_key = parse_connection_str(self.connection_str) credential = create_token_credential() phone_number_client = PhoneNumbersClient( endpoint, credential, http_logging_policy=get_http_logging_policy()) phone_numbers = phone_number_client.list_purchased_phone_numbers() assert phone_numbers.next()
def _get_managed_identity_phone_number_client(self): endpoint, access_key = parse_connection_str(self.connection_str) credential = create_token_credential() return PhoneNumbersClient( endpoint, credential, http_logging_policy=get_http_logging_policy(), headers_policy=get_header_policy() )
async def test_list_acquired_phone_numbers_from_managed_identity(self): endpoint, access_key = parse_connection_str(self.connection_str) credential = create_token_credential() phone_number_client = PhoneNumbersClient(endpoint, credential) async with self.phone_number_client: phone_numbers = phone_number_client.list_acquired_phone_numbers() items = [] async for item in phone_numbers: items.append(item) assert len(items) > 0
async def test_get_purchased_phone_number_from_managed_identity(self): endpoint, access_key = parse_connection_str(self.connection_str) credential = create_token_credential() phone_number_client = PhoneNumbersClient( endpoint, credential, http_logging_policy=get_http_logging_policy()) async with phone_number_client: phone_number = await phone_number_client.get_purchased_phone_number( self.phone_number) assert phone_number.phone_number == self.phone_number
def test_update_phone_number_capabilities_from_managed_identity(self): endpoint, access_key = parse_connection_str(self.connection_str) credential = create_token_credential() phone_number_client = PhoneNumbersClient(endpoint, credential) poller = phone_number_client.begin_update_phone_number_capabilities( self.phone_number, PhoneNumberCapabilityType.INBOUND_OUTBOUND, PhoneNumberCapabilityType.INBOUND, polling=True) poller.result() assert poller.status() == PhoneNumberOperationStatus.SUCCEEDED.value
async def test_update_phone_number_capabilities_from_managed_identity( self): endpoint, access_key = parse_connection_str(self.connection_str) credential = create_token_credential() phone_number_client = PhoneNumbersClient(endpoint, credential) async with phone_number_client: poller = await phone_number_client.begin_update_phone_number_capabilities( self.phone_number, PhoneNumberCapabilityType.INBOUND_OUTBOUND, PhoneNumberCapabilityType.INBOUND, polling=True) assert poller.result()
async def test_list_purchased_phone_numbers_from_managed_identity(self): endpoint, access_key = parse_connection_str(self.connection_str) credential = create_token_credential() phone_number_client = PhoneNumbersClient( endpoint, credential, http_logging_policy=get_http_logging_policy()) async with phone_number_client: phone_numbers = phone_number_client.list_purchased_phone_numbers() items = [] async for item in phone_numbers: items.append(item) assert len(items) > 0
def test_search_available_phone_numbers_from_managed_identity(self): endpoint, access_key = parse_connection_str(self.connection_str) credential = create_token_credential() phone_number_client = PhoneNumbersClient(endpoint, credential) capabilities = PhoneNumberCapabilities( calling=PhoneNumberCapabilityType.INBOUND, sms=PhoneNumberCapabilityType.INBOUND_OUTBOUND) poller = phone_number_client.begin_search_available_phone_numbers( self.country_code, PhoneNumberType.TOLL_FREE, PhoneNumberAssignmentType.APPLICATION, capabilities, polling=True) assert poller.result()
def test_update_phone_number_capabilities_from_managed_identity(self): endpoint, access_key = parse_connection_str(self.connection_str) credential = create_token_credential() phone_number_client = PhoneNumbersClient( endpoint, credential, http_logging_policy=get_http_logging_policy()) current_phone_number = phone_number_client.get_purchased_phone_number( self.phone_number) calling_capabilities = PhoneNumberCapabilityType.INBOUND if current_phone_number.capabilities.calling == PhoneNumberCapabilityType.OUTBOUND else PhoneNumberCapabilityType.OUTBOUND sms_capabilities = PhoneNumberCapabilityType.INBOUND_OUTBOUND if current_phone_number.capabilities.sms == PhoneNumberCapabilityType.OUTBOUND else PhoneNumberCapabilityType.OUTBOUND poller = phone_number_client.begin_update_phone_number_capabilities( self.phone_number, sms_capabilities, calling_capabilities, polling=True) assert poller.result() assert poller.status() == PhoneNumberOperationStatus.SUCCEEDED.value