diff --git a/sdk/communication/azure-communication-phonenumbers/README.md b/sdk/communication/azure-communication-phonenumbers/README.md index 6a28ebb57a68..90930ca058ab 100644 --- a/sdk/communication/azure-communication-phonenumbers/README.md +++ b/sdk/communication/azure-communication-phonenumbers/README.md @@ -95,8 +95,8 @@ poller = phone_numbers_client.begin_search_available_phone_numbers( PhoneNumberType.TOLL_FREE, PhoneNumberAssignmentType.APPLICATION, capabilities, - "833", # Area code is optional for toll-free numbers - 1, # Quantity is optional, default is 1 + area_code ="833", # Area code is optional for toll-free numbers + quantity = 2, # Quantity is optional. If not set, default is 1 polling = True ) search_result = poller.result() diff --git a/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/_phone_numbers_client.py b/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/_phone_numbers_client.py index c2704c822724..f392b4a00ae3 100644 --- a/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/_phone_numbers_client.py +++ b/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/_phone_numbers_client.py @@ -88,7 +88,6 @@ def begin_release_phone_number( :param phone_number: Phone number to be released, e.g. +11234567890. :type phone_number: str - :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: Pass in True if you'd like the LROBasePolling polling method, False for no polling, or your own initialized polling object for a personal polling strategy. @@ -109,7 +108,6 @@ def begin_search_available_phone_numbers( phone_number_type, # type: str assignment_type, # type: str capabilities, # type: PhoneNumberCapabilities - quantity=None, # type: int **kwargs # type: Any ): # type: (...) -> LROPoller[PhoneNumberSearchResult] @@ -127,10 +125,9 @@ def begin_search_available_phone_numbers( ~azure.communication.phonenumbers.models.PhoneNumberAssignmentType :param capabilities: Required. Capabilities of a phone number. :type capabilities: ~azure.communication.phonenumbers.models.PhoneNumberCapabilities - :param quantity: The quantity of phone numbers in the search. Should be at least 1. - :type quantity: int :keyword str area_code: The area code of the desired phone number, e.g. 425. If not set, any area code could be used in the final search. + :keyword int quantity: The quantity of phone numbers in the search. Default is 1. :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: Pass in True if you'd like the LROBasePolling polling method, False for no polling, or your own initialized polling object for a personal polling strategy. @@ -143,7 +140,7 @@ def begin_search_available_phone_numbers( phone_number_type=phone_number_type, assignment_type=assignment_type, capabilities=capabilities, - quantity=quantity, + quantity=kwargs.pop('quantity', None), area_code=kwargs.pop('area_code', None) ) return self._phone_number_client.phone_numbers.begin_search_available_phone_numbers( diff --git a/sdk/communication/azure-communication-phonenumbers/setup.py b/sdk/communication/azure-communication-phonenumbers/setup.py index f25bf8764c33..f5d560282c3b 100644 --- a/sdk/communication/azure-communication-phonenumbers/setup.py +++ b/sdk/communication/azure-communication-phonenumbers/setup.py @@ -49,7 +49,6 @@ 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', diff --git a/sdk/communication/azure-communication-phonenumbers/test/_shared/testcase.py b/sdk/communication/azure-communication-phonenumbers/test/_shared/testcase.py index bda0dbdb7bdf..97f79f4cfdf6 100644 --- a/sdk/communication/azure-communication-phonenumbers/test/_shared/testcase.py +++ b/sdk/communication/azure-communication-phonenumbers/test/_shared/testcase.py @@ -73,7 +73,7 @@ def setUp(self): super(CommunicationTestCase, self).setUp() if self.is_playback(): - self.connection_str = "endpoint=https://sanitized/;accesskey=fake===" + self.connection_str = "endpoint=https://sanitized.communication.azure.com/;accesskey=fake===" else: self.connection_str = os.getenv('AZURE_COMMUNICATION_SERVICE_CONNECTION_STRING') endpoint, _ = parse_connection_str(self.connection_str) diff --git a/sdk/communication/azure-communication-phonenumbers/test/phone_number_helper.py b/sdk/communication/azure-communication-phonenumbers/test/phone_number_helper.py index fc84aeb70d23..dc68059352bb 100644 --- a/sdk/communication/azure-communication-phonenumbers/test/phone_number_helper.py +++ b/sdk/communication/azure-communication-phonenumbers/test/phone_number_helper.py @@ -10,17 +10,13 @@ class PhoneNumberUriReplacer(RecordingProcessor): def process_request(self, request): import re - request.uri = re.sub('/identities/([^/?]+)', '/identities/sanitized', request.uri) + request.uri = re.sub('phoneNumbers/[%2B\d]+', 'phoneNumbers/sanitized', request.uri) return request def process_response(self, response): import re if 'url' in response: - response['url'] = re.sub('/identities/([^/?]+)', '/identities/sanitized', response['url']) - response['url'] = re.sub('phonePlanId=([^/?&]+)', 'phonePlanId=sanitized', response['url']) response['url'] = re.sub('capabilities/([^/?&]+)', 'capabilities/sanitized', response['url']) - response['url'] = re.sub('phoneplangroups/([^/?&]+)', 'phoneplangroups/sanitized', response['url']) - response['url'] = re.sub('phoneplans/([^/?&]+)', 'phoneplans/sanitized', response['url']) response['url'] = re.sub('releases/([^/?&]+)', 'releases/sanitized', response['url']) response['url'] = re.sub('searches/([^/?&]+)', 'searches/sanitized', response['url']) return response \ No newline at end of file diff --git a/sdk/communication/azure-communication-phonenumbers/test/recordings/test_phone_number_administration_client.test_get_phone_number.yaml b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_phone_number_administration_client.test_get_phone_number.yaml index 8133e743555a..fc085da4f131 100644 --- a/sdk/communication/azure-communication-phonenumbers/test/recordings/test_phone_number_administration_client.test_get_phone_number.yaml +++ b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_phone_number_administration_client.test_get_phone_number.yaml @@ -9,31 +9,32 @@ interactions: Connection: - keep-alive Date: - - Mon, 22 Feb 2021 19:48:24 GMT + - Thu, 04 Mar 2021 20:09:28 GMT User-Agent: - azsdk-python-communication-administration/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0) x-ms-return-client-request-id: - 'true' method: GET - uri: https://sanitized.communication.azure.com/phoneNumbers/%2B18335260208?api-version=2021-03-07 + uri: https://sanitized.communication.azure.com/phoneNumbers/sanitized?api-version=2021-03-07 response: body: string: '{"id": "sanitized", "phoneNumber": "sanitized", "countryCode": "US", - "phoneNumberType": "TollFree", "capabilities": {"calling": "inbound+outbound", - "sms": "outbound"}, "assignmentType": "Application"}' + "phoneNumberType": "TollFree", "capabilities": {"calling": "inbound", "sms": + "inbound+outbound"}, "assignmentType": "Application", "purchaseDate": "2020-11-30T17:51:21.2991518+00:00", + "cost": {"amount": 2.0, "currencyCode": "USD", "billingFrequency": "Monthly"}}' headers: content-type: - application/json; charset=utf-8 date: - - Mon, 22 Feb 2021 19:48:23 GMT + - Thu, 04 Mar 2021 20:09:30 GMT ms-cv: - - KQDB5Gt5/EiYmdjzTHoodQ.0 + - b1QfQvNXJUCmudxXTNXVYw.0 request-context: - appId= transfer-encoding: - chunked x-processing-time: - - 847ms + - 1995ms status: code: 200 message: OK diff --git a/sdk/communication/azure-communication-phonenumbers/test/recordings/test_phone_number_administration_client.test_list_acquired_phone_numbers.yaml b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_phone_number_administration_client.test_list_acquired_phone_numbers.yaml index 8c2f54af5f70..2d767d98e340 100644 --- a/sdk/communication/azure-communication-phonenumbers/test/recordings/test_phone_number_administration_client.test_list_acquired_phone_numbers.yaml +++ b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_phone_number_administration_client.test_list_acquired_phone_numbers.yaml @@ -9,7 +9,7 @@ interactions: Connection: - keep-alive Date: - - Tue, 02 Mar 2021 22:15:48 GMT + - Thu, 04 Mar 2021 20:09:31 GMT User-Agent: - azsdk-python-communication-administration/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0) x-ms-return-client-request-id: @@ -18,20 +18,20 @@ interactions: uri: https://sanitized.communication.azure.com/phoneNumbers?skip=0&top=100&api-version=2021-03-07 response: body: - string: '{"phoneNumbers": "sanitized"}' + string: '{"phoneNumbers": ["sanitized"]}' headers: content-type: - application/json; charset=utf-8 date: - - Tue, 02 Mar 2021 22:15:52 GMT + - Thu, 04 Mar 2021 20:09:34 GMT ms-cv: - - 1414CoW0X0iYJWEiELIX2A.0 + - Aa07dXCJ1Eiv8sLy5yURtA.0 request-context: - appId= transfer-encoding: - chunked x-processing-time: - - 4208ms + - 4239ms status: code: 200 message: OK diff --git a/sdk/communication/azure-communication-phonenumbers/test/recordings/test_phone_number_administration_client.test_purchase_phone_numbers.yaml b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_phone_number_administration_client.test_purchase_phone_numbers.yaml new file mode 100644 index 000000000000..927be673d40e --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_phone_number_administration_client.test_purchase_phone_numbers.yaml @@ -0,0 +1,257 @@ +interactions: +- request: + body: '{"phoneNumberType": "tollFree", "assignmentType": "application", "capabilities": + {"calling": "inbound", "sms": "inbound+outbound"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '131' + Content-Type: + - application/json + Date: + - Thu, 04 Mar 2021 19:00:18 GMT + User-Agent: + - azsdk-python-communication-administration/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0) + x-ms-return-client-request-id: + - 'true' + method: POST + uri: https://sanitized.communication.azure.com/availablePhoneNumbers/countries/US/:search?api-version=2021-03-07 + response: + body: + string: '' + headers: + access-control-expose-headers: + - Location,Operation-Location,operation-id,search-id + content-length: + - '0' + date: + - Thu, 04 Mar 2021 19:00:21 GMT + ms-cv: + - cnDAlYZUaUq80DHCaL9HkQ.0 + operation-id: + - search_bc5ccc45-c46e-4e35-a4cb-b8309e4ef211 + operation-location: + - /phoneNumbers/operations/search_bc5ccc45-c46e-4e35-a4cb-b8309e4ef211?api-version=2021-03-07 + request-context: + - appId= + search-id: + - bc5ccc45-c46e-4e35-a4cb-b8309e4ef211 + x-processing-time: + - 3170ms + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Date: + - Thu, 04 Mar 2021 19:00:52 GMT + User-Agent: + - azsdk-python-communication-administration/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0) + x-ms-return-client-request-id: + - 'true' + method: GET + uri: https://sanitized.communication.azure.com/phoneNumbers/operations/search_bc5ccc45-c46e-4e35-a4cb-b8309e4ef211?api-version=2021-03-07 + response: + body: + string: '{"status": "Succeeded", "resourceLocation": "/availablePhoneNumbers/searchResults/bc5ccc45-c46e-4e35-a4cb-b8309e4ef211?api-version=2021-03-07", + "createdDateTime": "2021-03-04T19:00:21.3580392+00:00", "id": "sanitized", + "operationType": "Search", "lastActionDateTime": "0001-01-01T00:00:00+00:00"}' + headers: + access-control-expose-headers: + - Location + content-type: + - application/json; charset=utf-8 + date: + - Thu, 04 Mar 2021 19:00:52 GMT + ms-cv: + - OpIdW4weIEGYzCsOBN5sbA.0 + request-context: + - appId= + transfer-encoding: + - chunked + x-processing-time: + - 572ms + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Date: + - Thu, 04 Mar 2021 19:00:52 GMT + User-Agent: + - azsdk-python-communication-administration/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0) + x-ms-return-client-request-id: + - 'true' + method: GET + uri: https://sanitized.communication.azure.com/availablePhoneNumbers/searchResults/bc5ccc45-c46e-4e35-a4cb-b8309e4ef211?api-version=2021-03-07 + response: + body: + string: '{"searchId": "bc5ccc45-c46e-4e35-a4cb-b8309e4ef211", "phoneNumbers": + "sanitized", "phoneNumberType": "TollFree", "assignmentType": "Application", + "capabilities": {"calling": "inbound", "sms": "inbound+outbound"}, "cost": + {"amount": 2.0, "currencyCode": "USD", "billingFrequency": "Monthly"}, "searchExpiresBy": + "2021-03-04T19:16:27.0466380+00:00"}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Thu, 04 Mar 2021 19:00:53 GMT + ms-cv: + - zyw0LCL7MkiWYMgLtDF7EQ.0 + request-context: + - appId= + transfer-encoding: + - chunked + x-processing-time: + - 957ms + status: + code: 200 + message: OK +- request: + body: '{"searchId": "bc5ccc45-c46e-4e35-a4cb-b8309e4ef211"}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '52' + Content-Type: + - application/json + Date: + - Thu, 04 Mar 2021 19:00:53 GMT + User-Agent: + - azsdk-python-communication-administration/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0) + x-ms-return-client-request-id: + - 'true' + method: POST + uri: https://sanitized.communication.azure.com/availablePhoneNumbers/:purchase?api-version=2021-03-07 + response: + body: + string: '' + headers: + access-control-expose-headers: + - Operation-Location,operation-id,purchase-id + content-length: + - '0' + date: + - Thu, 04 Mar 2021 19:00:55 GMT + ms-cv: + - vZooSJe6KkmD8SFNUMVGfg.0 + operation-id: + - purchase_bc5ccc45-c46e-4e35-a4cb-b8309e4ef211 + operation-location: + - /phoneNumbers/operations/purchase_bc5ccc45-c46e-4e35-a4cb-b8309e4ef211?api-version=2021-03-07 + purchase-id: + - bc5ccc45-c46e-4e35-a4cb-b8309e4ef211 + request-context: + - appId= + x-processing-time: + - 2267ms + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Date: + - Thu, 04 Mar 2021 19:01:26 GMT + User-Agent: + - azsdk-python-communication-administration/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0) + x-ms-return-client-request-id: + - 'true' + method: GET + uri: https://sanitized.communication.azure.com/phoneNumbers/operations/purchase_bc5ccc45-c46e-4e35-a4cb-b8309e4ef211?api-version=2021-03-07 + response: + body: + string: '{"status": "Succeeded", "resourceLocation": null, "createdDateTime": + "2021-03-04T19:00:21.3580392+00:00", "id": "sanitized", "operationType": "Purchase", + "lastActionDateTime": "0001-01-01T00:00:00+00:00"}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Thu, 04 Mar 2021 19:01:26 GMT + ms-cv: + - jW8zvj4iqkWUwa/mnePf3w.0 + request-context: + - appId= + transfer-encoding: + - chunked + x-processing-time: + - 450ms + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Thu, 04 Mar 2021 19:01:26 GMT + User-Agent: + - azsdk-python-communication-administration/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0) + x-ms-return-client-request-id: + - 'true' + method: DELETE + uri: https://sanitized.communication.azure.com/phoneNumbers/%2B18445499820?api-version=2021-03-07 + response: + body: + string: '' + headers: + access-control-expose-headers: + - Operation-Location,operation-id,release-id + content-length: + - '0' + date: + - Thu, 04 Mar 2021 19:01:27 GMT + ms-cv: + - 3Rh4W/qNvkGW649JaIS4yw.0 + operation-id: + - release_eadbe0e5-0ebd-4018-a05f-f4b708480a7d + operation-location: + - /phoneNumbers/operations/release_eadbe0e5-0ebd-4018-a05f-f4b708480a7d?api-version=2021-03-07 + release-id: + - eadbe0e5-0ebd-4018-a05f-f4b708480a7d + request-context: + - appId= + x-processing-time: + - 1436ms + status: + code: 202 + message: Accepted +version: 1 diff --git a/sdk/communication/azure-communication-phonenumbers/test/recordings/test_phone_number_administration_client.test_release_phone_number.yaml b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_phone_number_administration_client.test_release_phone_number.yaml index c8cb46b97265..aab21e2f175a 100644 --- a/sdk/communication/azure-communication-phonenumbers/test/recordings/test_phone_number_administration_client.test_release_phone_number.yaml +++ b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_phone_number_administration_client.test_release_phone_number.yaml @@ -11,28 +11,36 @@ interactions: Content-Length: - '0' Date: - - Tue, 09 Feb 2021 23:10:08 GMT + - Thu, 04 Mar 2021 17:04:48 GMT User-Agent: - azsdk-python-communication-administration/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0) x-ms-return-client-request-id: - 'true' method: DELETE - uri: https://sanitized.communication.azure.com/phoneNumbers/%2B18332272441?api-version=2021-03-07 + uri: https://sanitized.communication.azure.com/phoneNumbers/%2B18445495681?api-version=2021-03-07 response: body: string: '' headers: + access-control-expose-headers: + - Operation-Location,operation-id,release-id + content-length: + - '0' date: - - Tue, 09 Feb 2021 23:10:09 GMT + - Thu, 04 Mar 2021 17:04:50 GMT ms-cv: - - zTSfQ5gkkkyKQCTsCcVa7A.0 + - 4M4iMTTkAU2EYlx+U1W1vA.0 + operation-id: + - release_66dd2b9f-0b4d-454f-81b2-4bea870c8740 operation-location: - - /phoneNumbers/operations/release_601597ca-7e59-4433-ae4f-da83aef7da98?api-version=2021-03-07 + - /phoneNumbers/operations/release_66dd2b9f-0b4d-454f-81b2-4bea870c8740?api-version=2021-03-07 + release-id: + - 66dd2b9f-0b4d-454f-81b2-4bea870c8740 request-context: - appId= x-processing-time: - - 1236ms + - 1496ms status: - code: 204 - message: No Content + code: 202 + message: Accepted version: 1 diff --git a/sdk/communication/azure-communication-phonenumbers/test/recordings/test_phone_number_administration_client.test_search_available_phone_numbers.yaml b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_phone_number_administration_client.test_search_available_phone_numbers.yaml new file mode 100644 index 000000000000..bbdc9f05b8b8 --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_phone_number_administration_client.test_search_available_phone_numbers.yaml @@ -0,0 +1,129 @@ +interactions: +- request: + body: '{"phoneNumberType": "tollFree", "assignmentType": "application", "capabilities": + {"calling": "inbound", "sms": "inbound+outbound"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '131' + Content-Type: + - application/json + Date: + - Thu, 04 Mar 2021 20:09:35 GMT + User-Agent: + - azsdk-python-communication-administration/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0) + x-ms-return-client-request-id: + - 'true' + method: POST + uri: https://sanitized.communication.azure.com/availablePhoneNumbers/countries/US/:search?api-version=2021-03-07 + response: + body: + string: '' + headers: + access-control-expose-headers: + - Location,Operation-Location,operation-id,search-id + content-length: + - '0' + date: + - Thu, 04 Mar 2021 20:09:38 GMT + ms-cv: + - xp+gSiPZFEi9TrSBlc6j9w.0 + operation-id: + - search_c0763b8c-895d-4bba-b312-bcf615a90b2d + operation-location: + - /phoneNumbers/operations/search_c0763b8c-895d-4bba-b312-bcf615a90b2d?api-version=2021-03-07 + request-context: + - appId= + search-id: + - c0763b8c-895d-4bba-b312-bcf615a90b2d + x-processing-time: + - 3391ms + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Date: + - Thu, 04 Mar 2021 20:10:09 GMT + User-Agent: + - azsdk-python-communication-administration/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0) + x-ms-return-client-request-id: + - 'true' + method: GET + uri: https://sanitized.communication.azure.com/phoneNumbers/operations/search_c0763b8c-895d-4bba-b312-bcf615a90b2d?api-version=2021-03-07 + response: + body: + string: '{"status": "Succeeded", "resourceLocation": "/availablePhoneNumbers/searchResults/c0763b8c-895d-4bba-b312-bcf615a90b2d?api-version=2021-03-07", + "createdDateTime": "2021-03-04T20:09:38.6605579+00:00", "id": "sanitized", + "operationType": "Search", "lastActionDateTime": "0001-01-01T00:00:00+00:00"}' + headers: + access-control-expose-headers: + - Location + content-type: + - application/json; charset=utf-8 + date: + - Thu, 04 Mar 2021 20:10:09 GMT + ms-cv: + - WJ4OvgfDfE22EY3w9XwIlA.0 + request-context: + - appId= + transfer-encoding: + - chunked + x-processing-time: + - 483ms + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Date: + - Thu, 04 Mar 2021 20:10:09 GMT + User-Agent: + - azsdk-python-communication-administration/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0) + x-ms-return-client-request-id: + - 'true' + method: GET + uri: https://sanitized.communication.azure.com/availablePhoneNumbers/searchResults/c0763b8c-895d-4bba-b312-bcf615a90b2d?api-version=2021-03-07 + response: + body: + string: '{"searchId": "c0763b8c-895d-4bba-b312-bcf615a90b2d", "phoneNumbers": + ["sanitized"], "phoneNumberType": "TollFree", "assignmentType": "Application", + "capabilities": {"calling": "inbound", "sms": "inbound+outbound"}, "cost": + {"amount": 2.0, "currencyCode": "USD", "billingFrequency": "Monthly"}, "searchExpiresBy": + "2021-03-04T20:25:44.8545724+00:00"}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Thu, 04 Mar 2021 20:10:10 GMT + ms-cv: + - yGgJPefdTUCTFErjWAngFA.0 + request-context: + - appId= + transfer-encoding: + - chunked + x-processing-time: + - 968ms + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/communication/azure-communication-phonenumbers/test/recordings/test_phone_number_administration_client.test_update_phone_number_capabilities.yaml b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_phone_number_administration_client.test_update_phone_number_capabilities.yaml new file mode 100644 index 000000000000..45ebf79305c6 --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_phone_number_administration_client.test_update_phone_number_capabilities.yaml @@ -0,0 +1,129 @@ +interactions: +- request: + body: '{"calling": "inbound", "sms": "inbound+outbound"}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '49' + Content-Type: + - application/merge-patch+json + Date: + - Thu, 04 Mar 2021 20:10:10 GMT + User-Agent: + - azsdk-python-communication-administration/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0) + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/phoneNumbers/sanitized/capabilities?api-version=2021-03-07 + response: + body: + string: '{"capabilitiesUpdateId": "c753b8c0-bf2e-4f28-ad44-487b3e55c126"}' + headers: + access-control-expose-headers: + - Operation-Location,Location,operation-id,capabilities-id + capabilities-id: + - c753b8c0-bf2e-4f28-ad44-487b3e55c126 + content-type: + - application/json; charset=utf-8 + date: + - Thu, 04 Mar 2021 20:10:11 GMT + ms-cv: + - nJy2pwvO2kOqoLVJr05Tlg.0 + operation-id: + - capabilities_c753b8c0-bf2e-4f28-ad44-487b3e55c126 + operation-location: + - /phoneNumbers/operations/capabilities_c753b8c0-bf2e-4f28-ad44-487b3e55c126?api-version=2021-03-07 + request-context: + - appId= + transfer-encoding: + - chunked + x-processing-time: + - 1111ms + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Date: + - Thu, 04 Mar 2021 20:10:42 GMT + User-Agent: + - azsdk-python-communication-administration/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0) + x-ms-return-client-request-id: + - 'true' + method: GET + uri: https://sanitized.communication.azure.com/phoneNumbers/operations/capabilities_c753b8c0-bf2e-4f28-ad44-487b3e55c126?api-version=2021-03-07 + response: + body: + string: '{"status": "Succeeded", "resourceLocation": "/phoneNumbers/+18332143261?api-version=2021-03-07", + "createdDateTime": "2021-03-04T20:10:11.7620886+00:00", "id": "sanitized", + "operationType": "UpdatePhoneNumberCapabilities", "lastActionDateTime": "0001-01-01T00:00:00+00:00"}' + headers: + access-control-expose-headers: + - Location + content-type: + - application/json; charset=utf-8 + date: + - Thu, 04 Mar 2021 20:10:43 GMT + ms-cv: + - bhOOUelnIEioRhByfOIYkQ.0 + request-context: + - appId= + transfer-encoding: + - chunked + x-processing-time: + - 2355ms + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Date: + - Thu, 04 Mar 2021 20:10:44 GMT + User-Agent: + - azsdk-python-communication-administration/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0) + x-ms-return-client-request-id: + - 'true' + method: GET + uri: https://sanitized.communication.azure.com/phoneNumbers/+18332143261?api-version=2021-03-07 + response: + body: + string: '{"id": "sanitized", "phoneNumber": "sanitized", "countryCode": "US", + "phoneNumberType": "TollFree", "capabilities": {"calling": "inbound", "sms": + "inbound+outbound"}, "assignmentType": "Application", "purchaseDate": "2020-11-30T17:51:21.2991518+00:00", + "cost": {"amount": 2.0, "currencyCode": "USD", "billingFrequency": "Monthly"}}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Thu, 04 Mar 2021 20:10:46 GMT + ms-cv: + - UmM4C4ozVkijkaibJMfTjQ.0 + request-context: + - appId= + transfer-encoding: + - chunked + x-processing-time: + - 2097ms + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/communication/azure-communication-phonenumbers/test/recordings/test_phone_number_administration_client_async.test_get_phone_number.yaml b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_phone_number_administration_client_async.test_get_phone_number.yaml index f52367daa393..4ebae7f27df7 100644 --- a/sdk/communication/azure-communication-phonenumbers/test/recordings/test_phone_number_administration_client_async.test_get_phone_number.yaml +++ b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_phone_number_administration_client_async.test_get_phone_number.yaml @@ -5,27 +5,28 @@ interactions: Accept: - application/json Date: - - Tue, 16 Feb 2021 19:45:38 GMT + - Thu, 04 Mar 2021 20:10:46 GMT User-Agent: - azsdk-python-communication-administration/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0) x-ms-return-client-request-id: - 'true' method: GET - uri: https://sanitized.communication.azure.com/phoneNumbers/%2B18332272412?api-version=2021-03-07 + uri: https://sanitized.communication.azure.com/phoneNumbers/sanitized?api-version=2021-03-07 response: body: string: '{"id": "sanitized", "phoneNumber": "sanitized", "countryCode": "US", "phoneNumberType": "TollFree", "capabilities": {"calling": "inbound", "sms": - "inbound+outbound"}, "assignmentType": "Application"}' + "inbound+outbound"}, "assignmentType": "Application", "purchaseDate": "2020-11-30T17:51:21.2991518+00:00", + "cost": {"amount": 2.0, "currencyCode": "USD", "billingFrequency": "Monthly"}}' headers: content-type: application/json; charset=utf-8 - date: Tue, 16 Feb 2021 19:45:39 GMT - ms-cv: pDmuqc/E1EGttt2gQZMupQ.0 + date: Thu, 04 Mar 2021 20:10:47 GMT + ms-cv: g+yRryu4o02OCKglJx1kXg.0 request-context: appId= transfer-encoding: chunked - x-processing-time: 960ms + x-processing-time: 1282ms status: code: 200 message: OK - url: https://sanitized.communication.azure.com/phoneNumbers/%2B18332272412?api-version=2021-03-07 + url: https://live-testing.communication.azure.com/phoneNumbers/%2B18332143261?api-version=2021-03-07 version: 1 diff --git a/sdk/communication/azure-communication-phonenumbers/test/recordings/test_phone_number_administration_client_async.test_list_acquired_phone_numbers.yaml b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_phone_number_administration_client_async.test_list_acquired_phone_numbers.yaml index c0d7daac80a7..952d2ff9dc0f 100644 --- a/sdk/communication/azure-communication-phonenumbers/test/recordings/test_phone_number_administration_client_async.test_list_acquired_phone_numbers.yaml +++ b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_phone_number_administration_client_async.test_list_acquired_phone_numbers.yaml @@ -5,7 +5,7 @@ interactions: Accept: - application/json Date: - - Mon, 22 Feb 2021 19:49:31 GMT + - Thu, 04 Mar 2021 20:10:48 GMT User-Agent: - azsdk-python-communication-administration/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0) x-ms-return-client-request-id: @@ -14,36 +14,35 @@ interactions: uri: https://sanitized.communication.azure.com/phoneNumbers?skip=0&top=100&api-version=2021-03-07 response: body: - string: '{"phoneNumbers": [{"id": "18332272412", "phoneNumber": "+18332272412", - "countryCode": "US", "phoneNumberType": "TollFree", "capabilities": {"calling": - "inbound", "sms": "inbound+outbound"}, "assignmentType": "Application"}, {"id": - "18332272430", "phoneNumber": "+18332272430", "countryCode": "US", "phoneNumberType": - "TollFree", "capabilities": {"calling": "inbound", "sms": "inbound+outbound"}, - "assignmentType": "Application"}, {"id": "18332272445", "phoneNumber": "+18332272445", - "countryCode": "US", "phoneNumberType": "TollFree", "capabilities": {"calling": - "inbound", "sms": "inbound+outbound"}, "assignmentType": "Application"}, {"id": - "18332321209", "phoneNumber": "+18332321209", "countryCode": "US", "phoneNumberType": - "TollFree", "capabilities": {"calling": "none", "sms": "inbound+outbound"}, - "assignmentType": "Application"}, {"id": "18332321221", "phoneNumber": "+18332321221", - "countryCode": "US", "phoneNumberType": "TollFree", "capabilities": {"calling": - "none", "sms": "inbound+outbound"}, "assignmentType": "Application"}, {"id": - "18332321226", "phoneNumber": "+18332321226", "countryCode": "US", "phoneNumberType": - "TollFree", "capabilities": {"calling": "none", "sms": "inbound+outbound"}, - "assignmentType": "Application"}, {"id": "18335260208", "phoneNumber": "+18335260208", - "countryCode": "US", "phoneNumberType": "TollFree", "capabilities": {"calling": - "inbound+outbound", "sms": "outbound"}, "assignmentType": "Application"}, - {"id": "18336369501", "phoneNumber": "+18336369501", "countryCode": "US", - "phoneNumberType": "TollFree", "capabilities": {"calling": "inbound+outbound", - "sms": "none"}, "assignmentType": "Application"}]}' + string: '{"phoneNumbers": [{"id": "16194895581", "phoneNumber": "+16194895581", + "countryCode": "US", "phoneNumberType": "Geographic", "capabilities": {"calling": + "outbound", "sms": "none"}, "assignmentType": "Person", "purchaseDate": "2021-01-13T20:01:52.0795301+00:00", + "cost": {"amount": 1.0, "currencyCode": "USD", "billingFrequency": "Monthly"}}, + {"id": "16194895593", "phoneNumber": "+16194895593", "countryCode": "US", + "phoneNumberType": "Geographic", "capabilities": {"calling": "outbound", "sms": + "none"}, "assignmentType": "Person", "purchaseDate": "2021-01-13T20:57:24.5482566+00:00", + "cost": {"amount": 1.0, "currencyCode": "USD", "billingFrequency": "Monthly"}}, + {"id": "18332143261", "phoneNumber": "+18332143261", "countryCode": "US", + "phoneNumberType": "TollFree", "capabilities": {"calling": "inbound", "sms": + "inbound+outbound"}, "assignmentType": "Application", "purchaseDate": "2020-11-30T17:51:21.2991518+00:00", + "cost": {"amount": 2.0, "currencyCode": "USD", "billingFrequency": "Monthly"}}, + {"id": "18443281555", "phoneNumber": "+18443281555", "countryCode": "US", + "phoneNumberType": "TollFree", "capabilities": {"calling": "none", "sms": + "inbound+outbound"}, "assignmentType": "Application", "purchaseDate": "2020-11-12T21:53:12.2088187+00:00", + "cost": {"amount": 2.0, "currencyCode": "USD", "billingFrequency": "Monthly"}}, + {"id": "18445492606", "phoneNumber": "+18445492606", "countryCode": "US", + "phoneNumberType": "TollFree", "capabilities": {"calling": "inbound", "sms": + "inbound+outbound"}, "assignmentType": "Application", "purchaseDate": "2021-03-04T19:24:10.3004481+00:00", + "cost": {"amount": 2.0, "currencyCode": "USD", "billingFrequency": "Monthly"}}]}' headers: content-type: application/json; charset=utf-8 - date: Mon, 22 Feb 2021 19:49:29 GMT - ms-cv: gR+k7FVMNkWEuGWjsZ5mUg.0 + date: Thu, 04 Mar 2021 20:10:51 GMT + ms-cv: XvhXXgKui0CweHemAySMfw.0 request-context: appId= transfer-encoding: chunked - x-processing-time: 930ms + x-processing-time: 3574ms status: code: 200 message: OK - url: https://sanitized.communication.azure.com/phoneNumbers?skip=0&top=100&api-version=2021-03-07 + url: https://live-testing.communication.azure.com/phoneNumbers?skip=0&top=100&api-version=2021-03-07 version: 1 diff --git a/sdk/communication/azure-communication-phonenumbers/test/recordings/test_phone_number_administration_client_async.test_list_all_phone_numbers_from_managed_identity.yaml b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_phone_number_administration_client_async.test_list_all_phone_numbers_from_managed_identity.yaml new file mode 100644 index 000000000000..23a9450384fa --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_phone_number_administration_client_async.test_list_all_phone_numbers_from_managed_identity.yaml @@ -0,0 +1,25 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/json + User-Agent: + - azsdk-python-communication-administration/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://sanitized.communication.azure.com/phoneNumbers?skip=0&top=100&api-version=2021-03-07 + response: + body: + string: '{"error": {"code": "Denied", "message": "Denied by the resource provider."}}' + headers: + content-type: application/json + date: Thu, 04 Mar 2021 18:16:08 GMT + ms-cv: SyFWaYd1okyG+rITVB0DKQ.0 + request-context: appId= + transfer-encoding: chunked + x-processing-time: 177ms + status: + code: 401 + message: Unauthorized + url: https://live-testing.communication.azure.com/phoneNumbers?skip=0&top=100&api-version=2021-03-07 +version: 1 diff --git a/sdk/communication/azure-communication-phonenumbers/test/recordings/test_phone_number_administration_client_async.test_purchase_phone_numbers.yaml b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_phone_number_administration_client_async.test_purchase_phone_numbers.yaml new file mode 100644 index 000000000000..367ebfae0896 --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_phone_number_administration_client_async.test_purchase_phone_numbers.yaml @@ -0,0 +1,185 @@ +interactions: +- request: + body: '{"phoneNumberType": "tollFree", "assignmentType": "application", "capabilities": + {"calling": "inbound", "sms": "inbound+outbound"}}' + headers: + Accept: + - application/json + Content-Length: + - '131' + Content-Type: + - application/json + Date: + - Thu, 04 Mar 2021 18:17:42 GMT + User-Agent: + - azsdk-python-communication-administration/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0) + x-ms-return-client-request-id: + - 'true' + method: POST + uri: https://sanitized.communication.azure.com/availablePhoneNumbers/countries/US/:search?api-version=2021-03-07 + response: + body: + string: '' + headers: + access-control-expose-headers: Location,Operation-Location,operation-id,search-id + content-length: '0' + date: Thu, 04 Mar 2021 18:17:45 GMT + ms-cv: /9Dp1W9J10W5ZzyvLykP6g.0 + operation-id: search_a061a85c-c652-44d8-b051-014b8d892a07 + operation-location: /phoneNumbers/operations/search_a061a85c-c652-44d8-b051-014b8d892a07?api-version=2021-03-07 + request-context: appId= + search-id: a061a85c-c652-44d8-b051-014b8d892a07 + x-processing-time: 3200ms + status: + code: 202 + message: Accepted + url: https://live-testing.communication.azure.com/availablePhoneNumbers/countries/US/:search?api-version=2021-03-07 +- request: + body: '' + headers: + Date: + - Thu, 04 Mar 2021 18:18:15 GMT + User-Agent: + - azsdk-python-communication-administration/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0) + x-ms-return-client-request-id: + - 'true' + method: GET + uri: https://sanitized.communication.azure.com/phoneNumbers/operations/search_a061a85c-c652-44d8-b051-014b8d892a07?api-version=2021-03-07 + response: + body: + string: '{"status": "Succeeded", "resourceLocation": "/availablePhoneNumbers/searchResults/a061a85c-c652-44d8-b051-014b8d892a07?api-version=2021-03-07", + "createdDateTime": "2021-03-04T18:17:45.1869951+00:00", "id": "sanitized", + "operationType": "Search", "lastActionDateTime": "0001-01-01T00:00:00+00:00"}' + headers: + access-control-expose-headers: Location + content-type: application/json; charset=utf-8 + date: Thu, 04 Mar 2021 18:18:15 GMT + ms-cv: An9SG0xNA02+nCEJ2iyPGg.0 + request-context: appId= + transfer-encoding: chunked + x-processing-time: 559ms + status: + code: 200 + message: OK + url: https://live-testing.communication.azure.com/phoneNumbers/operations/search_a061a85c-c652-44d8-b051-014b8d892a07?api-version=2021-03-07 +- request: + body: '' + headers: + Date: + - Thu, 04 Mar 2021 18:18:16 GMT + User-Agent: + - azsdk-python-communication-administration/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0) + x-ms-return-client-request-id: + - 'true' + method: GET + uri: https://sanitized.communication.azure.com/availablePhoneNumbers/searchResults/a061a85c-c652-44d8-b051-014b8d892a07?api-version=2021-03-07 + response: + body: + string: '{"searchId": "a061a85c-c652-44d8-b051-014b8d892a07", "phoneNumbers": + ["+18445496587"], "phoneNumberType": "TollFree", "assignmentType": "Application", + "capabilities": {"calling": "inbound", "sms": "inbound+outbound"}, "cost": + {"amount": 2.0, "currencyCode": "USD", "billingFrequency": "Monthly"}, "searchExpiresBy": + "2021-03-04T18:33:53.9609193+00:00"}' + headers: + content-type: application/json; charset=utf-8 + date: Thu, 04 Mar 2021 18:18:17 GMT + ms-cv: tajtINiuYU6xpPdp0AwTzA.0 + request-context: appId= + transfer-encoding: chunked + x-processing-time: 1571ms + status: + code: 200 + message: OK + url: https://live-testing.communication.azure.com/availablePhoneNumbers/searchResults/a061a85c-c652-44d8-b051-014b8d892a07?api-version=2021-03-07 +- request: + body: '{"searchId": "a061a85c-c652-44d8-b051-014b8d892a07"}' + headers: + Accept: + - application/json + Content-Length: + - '52' + Content-Type: + - application/json + Date: + - Thu, 04 Mar 2021 18:18:18 GMT + User-Agent: + - azsdk-python-communication-administration/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0) + x-ms-return-client-request-id: + - 'true' + method: POST + uri: https://sanitized.communication.azure.com/availablePhoneNumbers/:purchase?api-version=2021-03-07 + response: + body: + string: '' + headers: + access-control-expose-headers: Operation-Location,operation-id,purchase-id + content-length: '0' + date: Thu, 04 Mar 2021 18:18:20 GMT + ms-cv: cfO6OqU0F0SdpnnF3G0Qxg.0 + operation-id: purchase_a061a85c-c652-44d8-b051-014b8d892a07 + operation-location: /phoneNumbers/operations/purchase_a061a85c-c652-44d8-b051-014b8d892a07?api-version=2021-03-07 + purchase-id: a061a85c-c652-44d8-b051-014b8d892a07 + request-context: appId= + x-processing-time: 2228ms + status: + code: 202 + message: Accepted + url: https://live-testing.communication.azure.com/availablePhoneNumbers/:purchase?api-version=2021-03-07 +- request: + body: '' + headers: + Date: + - Thu, 04 Mar 2021 18:18:50 GMT + User-Agent: + - azsdk-python-communication-administration/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0) + x-ms-return-client-request-id: + - 'true' + method: GET + uri: https://sanitized.communication.azure.com/phoneNumbers/operations/purchase_a061a85c-c652-44d8-b051-014b8d892a07?api-version=2021-03-07 + response: + body: + string: '{"status": "Succeeded", "resourceLocation": null, "createdDateTime": + "2021-03-04T18:17:45.1869951+00:00", "id": "sanitized", "operationType": "Purchase", + "lastActionDateTime": "0001-01-01T00:00:00+00:00"}' + headers: + content-type: application/json; charset=utf-8 + date: Thu, 04 Mar 2021 18:18:50 GMT + ms-cv: 2BX6oEo9cEOkNVEY8GJghg.0 + request-context: appId= + transfer-encoding: chunked + x-processing-time: 530ms + status: + code: 200 + message: OK + url: https://live-testing.communication.azure.com/phoneNumbers/operations/purchase_a061a85c-c652-44d8-b051-014b8d892a07?api-version=2021-03-07 +- request: + body: '' + headers: + Accept: + - application/json + Date: + - Thu, 04 Mar 2021 18:18:51 GMT + User-Agent: + - azsdk-python-communication-administration/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0) + x-ms-return-client-request-id: + - 'true' + method: DELETE + uri: https://sanitized.communication.azure.com/phoneNumbers/%2B18445496587?api-version=2021-03-07 + response: + body: + string: '' + headers: + access-control-expose-headers: Operation-Location,operation-id,release-id + content-length: '0' + date: Thu, 04 Mar 2021 18:18:51 GMT + ms-cv: nPiFBK6ha02zRzkcjIkNwA.0 + operation-id: release_4427e952-844b-4d4a-9830-774e2b588066 + operation-location: /phoneNumbers/operations/release_4427e952-844b-4d4a-9830-774e2b588066?api-version=2021-03-07 + release-id: 4427e952-844b-4d4a-9830-774e2b588066 + request-context: appId= + x-processing-time: 872ms + status: + code: 202 + message: Accepted + url: https://live-testing.communication.azure.com/phoneNumbers/%2B18445496587?api-version=2021-03-07 +version: 1 diff --git a/sdk/communication/azure-communication-phonenumbers/test/recordings/test_phone_number_administration_client_async.test_search_available_phone_numbers.yaml b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_phone_number_administration_client_async.test_search_available_phone_numbers.yaml new file mode 100644 index 000000000000..dc596a27a626 --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_phone_number_administration_client_async.test_search_available_phone_numbers.yaml @@ -0,0 +1,37 @@ +interactions: +- request: + body: '{"phoneNumberType": "tollFree", "assignmentType": "application", "capabilities": + {"calling": "inbound", "sms": "inbound+outbound"}}' + headers: + Accept: + - application/json + Content-Length: + - '131' + Content-Type: + - application/json + Date: + - Thu, 04 Mar 2021 20:10:52 GMT + User-Agent: + - azsdk-python-communication-administration/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0) + x-ms-return-client-request-id: + - 'true' + method: POST + uri: https://sanitized.communication.azure.com/availablePhoneNumbers/countries/US/:search?api-version=2021-03-07 + response: + body: + string: '' + headers: + access-control-expose-headers: Location,Operation-Location,operation-id,search-id + content-length: '0' + date: Thu, 04 Mar 2021 20:10:54 GMT + ms-cv: 8WLGSUfKPU6zyEk9ShCZmw.0 + operation-id: search_d2b92f7d-1c61-481c-ac7d-044754b422bb + operation-location: /phoneNumbers/operations/search_d2b92f7d-1c61-481c-ac7d-044754b422bb?api-version=2021-03-07 + request-context: appId= + search-id: d2b92f7d-1c61-481c-ac7d-044754b422bb + x-processing-time: 2876ms + status: + code: 202 + message: Accepted + url: https://live-testing.communication.azure.com/availablePhoneNumbers/countries/US/:search?api-version=2021-03-07 +version: 1 diff --git a/sdk/communication/azure-communication-phonenumbers/test/recordings/test_phone_number_administration_client_async.test_update_phone_number_capabilities.yaml b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_phone_number_administration_client_async.test_update_phone_number_capabilities.yaml new file mode 100644 index 000000000000..46e9b930efed --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_phone_number_administration_client_async.test_update_phone_number_capabilities.yaml @@ -0,0 +1,37 @@ +interactions: +- request: + body: '{"calling": "inbound", "sms": "inbound+outbound"}' + headers: + Accept: + - application/json + Content-Length: + - '49' + Content-Type: + - application/merge-patch+json + Date: + - Thu, 04 Mar 2021 20:10:55 GMT + User-Agent: + - azsdk-python-communication-administration/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0) + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/phoneNumbers/sanitized/capabilities?api-version=2021-03-07 + response: + body: + string: '{"capabilitiesUpdateId": "a51ebf71-91f5-4410-917a-1d3993e8d7ae"}' + headers: + access-control-expose-headers: Operation-Location,Location,operation-id,capabilities-id + capabilities-id: a51ebf71-91f5-4410-917a-1d3993e8d7ae + content-type: application/json; charset=utf-8 + date: Thu, 04 Mar 2021 20:10:56 GMT + ms-cv: nQRrDvDF9kSmUHvSW2nJNw.0 + operation-id: capabilities_a51ebf71-91f5-4410-917a-1d3993e8d7ae + operation-location: /phoneNumbers/operations/capabilities_a51ebf71-91f5-4410-917a-1d3993e8d7ae?api-version=2021-03-07 + request-context: appId= + transfer-encoding: chunked + x-processing-time: 1183ms + status: + code: 202 + message: Accepted + url: https://live-testing.communication.azure.com/phoneNumbers/%2B18332143261/capabilities?api-version=2021-03-07 +version: 1 diff --git a/sdk/communication/azure-communication-phonenumbers/test/test_phone_number_administration_client.py b/sdk/communication/azure-communication-phonenumbers/test/test_phone_number_administration_client.py index b117dd1e886c..67f4d51a526c 100644 --- a/sdk/communication/azure-communication-phonenumbers/test/test_phone_number_administration_client.py +++ b/sdk/communication/azure-communication-phonenumbers/test/test_phone_number_administration_client.py @@ -5,13 +5,16 @@ from _shared.utils import create_token_credential from azure.communication.phonenumbers import PhoneNumberAssignmentType, PhoneNumberCapabilities, PhoneNumberCapabilityValue, PhoneNumberType from azure.communication.phonenumbers._shared.utils import parse_connection_str +from phone_number_helper import PhoneNumberUriReplacer + +SKIP_PURCHASE_PHONE_NUMBER_TESTS = True +PURCHASE_PHONE_NUMBER_TEST_SKIP_REASON = "Phone numbers shouldn't be purchased in live tests" class NewTests(CommunicationTestCase): def setUp(self): super(NewTests, self).setUp() if self.is_playback(): - self.phone_number = "+18000005555" - self.phone_number_to_release = "+18000005556" + self.phone_number = "sanitized" self.country_code = "US" self.area_code = "833" else: @@ -22,11 +25,11 @@ def setUp(self): self.phone_number_client = PhoneNumbersClient.from_connection_string(self.connection_str) self.recording_processors.extend([ BodyReplacerProcessor( - keys=["id", "token", "phoneNumber", "phonenumbers", "phoneNumbers"] + keys=["id", "token", "phoneNumber"] ), - ResponseReplacerProcessor(keys=[self._resource_name])]) + PhoneNumberUriReplacer()]) - @pytest.mark.live_test_only + @pytest.mark.skipif(SKIP_PURCHASE_PHONE_NUMBER_TESTS, reason=PURCHASE_PHONE_NUMBER_TEST_SKIP_REASON) def test_list_all_phone_numbers_from_managed_identity(self): endpoint, access_key = parse_connection_str(self.connection_str) credential = create_token_credential() @@ -34,22 +37,14 @@ def test_list_all_phone_numbers_from_managed_identity(self): phone_numbers = phone_number_client.list_all_phone_numbers() assert phone_numbers.next() - @pytest.mark.live_test_only def test_list_acquired_phone_numbers(self): phone_numbers = self.phone_number_client.list_acquired_phone_numbers() assert phone_numbers.next() - @pytest.mark.live_test_only def test_get_phone_number(self): phone_number = self.phone_number_client.get_phone_number(self.phone_number) assert phone_number.phone_number == self.phone_number - - @pytest.mark.live_test_only - def test_release_phone_number(self): - poller = self.phone_number_client.begin_release_phone_number(self.phone_number_to_release) - assert poller.status() == 'succeeded' - @pytest.mark.live_test_only def test_search_available_phone_numbers(self): capabilities = PhoneNumberCapabilities( calling = PhoneNumberCapabilityValue.INBOUND, @@ -65,17 +60,16 @@ def test_search_available_phone_numbers(self): ) assert poller.result() - @pytest.mark.live_test_only def test_update_phone_number_capabilities(self): poller = self.phone_number_client.begin_update_phone_number_capabilities( - self.phone_number, - PhoneNumberCapabilityValue.OUTBOUND, - PhoneNumberCapabilityValue.INBOUND_OUTBOUND, - polling = True + self.phone_number, + PhoneNumberCapabilityValue.INBOUND_OUTBOUND, + PhoneNumberCapabilityValue.INBOUND, + polling = True ) assert poller.result() - - @pytest.mark.live_test_only + + @pytest.mark.skipif(SKIP_PURCHASE_PHONE_NUMBER_TESTS, reason=PURCHASE_PHONE_NUMBER_TEST_SKIP_REASON) def test_purchase_phone_numbers(self): capabilities = PhoneNumberCapabilities( calling = PhoneNumberCapabilityValue.INBOUND, @@ -86,12 +80,11 @@ def test_purchase_phone_numbers(self): PhoneNumberType.TOLL_FREE, PhoneNumberAssignmentType.APPLICATION, capabilities, - self.area_code, - 1, + area_code=self.area_code, polling = True ) phone_number_to_buy = search_poller.result() purchase_poller = self.phone_number_client.begin_purchase_phone_numbers(phone_number_to_buy.search_id, polling=True) assert purchase_poller.result() - release_poller = self.phone_number_client.begin_release_phone_number(phone_number_to_buy.phone_number) + release_poller = self.phone_number_client.begin_release_phone_number(phone_number_to_buy.phone_numbers[0]) assert release_poller.status() == 'succeeded' diff --git a/sdk/communication/azure-communication-phonenumbers/test/test_phone_number_administration_client_async.py b/sdk/communication/azure-communication-phonenumbers/test/test_phone_number_administration_client_async.py index 7dc30f0ee7b5..a2f049c6e1e6 100644 --- a/sdk/communication/azure-communication-phonenumbers/test/test_phone_number_administration_client_async.py +++ b/sdk/communication/azure-communication-phonenumbers/test/test_phone_number_administration_client_async.py @@ -4,8 +4,12 @@ from _shared.asynctestcase import AsyncCommunicationTestCase from _shared.testcase import ResponseReplacerProcessor, BodyReplacerProcessor from _shared.utils import create_token_credential -from azure.communication.phonenumbers import PhoneNumberAssignmentType, PhoneNumberCapabilities, PhoneNumberCapabilityType, PhoneNumberType +from azure.communication.phonenumbers import PhoneNumberAssignmentType, PhoneNumberCapabilities, PhoneNumberCapabilityValue, PhoneNumberType from azure.communication.phonenumbers._shared.utils import parse_connection_str +from phone_number_helper import PhoneNumberUriReplacer + +SKIP_PURCHASE_PHONE_NUMBER_TESTS = True +PURCHASE_PHONE_NUMBER_TEST_SKIP_REASON = "Phone numbers shouldn't be purchased in live tests" class NewTests(AsyncCommunicationTestCase): def setUp(self): @@ -26,10 +30,10 @@ def setUp(self): BodyReplacerProcessor( keys=["id", "token", "phoneNumber", "phonenumbers"] ), - ResponseReplacerProcessor(keys=[self._resource_name])]) - + PhoneNumberUriReplacer()]) + + @pytest.mark.skipif(SKIP_PURCHASE_PHONE_NUMBER_TESTS, reason=PURCHASE_PHONE_NUMBER_TEST_SKIP_REASON) @AsyncCommunicationTestCase.await_prepared_test - @pytest.mark.live_test_only async def test_list_all_phone_numbers_from_managed_identity(self): endpoint, access_key = parse_connection_str(self.connection_str) credential = create_token_credential() @@ -42,7 +46,6 @@ async def test_list_all_phone_numbers_from_managed_identity(self): assert len(items) > 0 @AsyncCommunicationTestCase.await_prepared_test - @pytest.mark.live_test_only async def test_list_acquired_phone_numbers(self): async with self.phone_number_client: phone_numbers = self.phone_number_client.list_acquired_phone_numbers() @@ -52,27 +55,16 @@ async def test_list_acquired_phone_numbers(self): assert len(items) > 0 @AsyncCommunicationTestCase.await_prepared_test - @pytest.mark.live_test_only async def test_get_phone_number(self): async with self.phone_number_client: phone_number = await self.phone_number_client.get_phone_number(self.phone_number) assert phone_number.phone_number == self.phone_number - - - @AsyncCommunicationTestCase.await_prepared_test - @pytest.mark.live_test_only - async def test_release_phone_number(self): - async with self.phone_number_client: - poller = await self.phone_number_client.begin_release_phone_number(self.phone_number_to_release) - result = await poller.result() - assert result @AsyncCommunicationTestCase.await_prepared_test - @pytest.mark.live_test_only async def test_search_available_phone_numbers(self): capabilities = PhoneNumberCapabilities( - calling = PhoneNumberCapabilityType.INBOUND, - sms = PhoneNumberCapabilityType.INBOUND_OUTBOUND + calling = PhoneNumberCapabilityValue.INBOUND, + sms = PhoneNumberCapabilityValue.INBOUND_OUTBOUND ) async with self.phone_number_client: poller = await self.phone_number_client.begin_search_available_phone_numbers( @@ -86,23 +78,22 @@ async def test_search_available_phone_numbers(self): assert poller.result() @AsyncCommunicationTestCase.await_prepared_test - @pytest.mark.live_test_only async def test_update_phone_number_capabilities(self): async with self.phone_number_client: - poller = self.phone_number_client.begin_update_phone_number_capabilities( + poller = await self.phone_number_client.begin_update_phone_number_capabilities( self.phone_number, - PhoneNumberCapabilityType.OUTBOUND, - PhoneNumberCapabilityType.OUTBOUND, + PhoneNumberCapabilityValue.INBOUND_OUTBOUND, + PhoneNumberCapabilityValue.INBOUND, polling = True ) assert poller.result() + @pytest.mark.skipif(SKIP_PURCHASE_PHONE_NUMBER_TESTS, reason=PURCHASE_PHONE_NUMBER_TEST_SKIP_REASON) @AsyncCommunicationTestCase.await_prepared_test - @pytest.mark.live_test_only async def test_purchase_phone_numbers(self): capabilities = PhoneNumberCapabilities( - calling = PhoneNumberCapabilityType.INBOUND, - sms = PhoneNumberCapabilityType.INBOUND_OUTBOUND + calling = PhoneNumberCapabilityValue.INBOUND, + sms = PhoneNumberCapabilityValue.INBOUND_OUTBOUND ) async with self.phone_number_client: search_poller = await self.phone_number_client.begin_search_available_phone_numbers( @@ -110,12 +101,11 @@ async def test_purchase_phone_numbers(self): PhoneNumberType.TOLL_FREE, PhoneNumberAssignmentType.APPLICATION, capabilities, - self.area_code, - 1, + area_code=self.area_code, polling = True ) - phone_number_to_buy = search_poller.result() + phone_number_to_buy = await search_poller.result() purchase_poller = await self.phone_number_client.begin_purchase_phone_numbers(phone_number_to_buy.search_id, polling=True) - assert purchase_poller.result() - release_poller = await self.phone_number_client.begin_release_phone_number(phone_number_to_buy.phone_number) + assert await purchase_poller.result() + release_poller = await self.phone_number_client.begin_release_phone_number(phone_number_to_buy.phone_numbers[0]) assert release_poller.status() == 'succeeded'