diff --git a/sdk/communication/azure-communication-administration/azure/communication/administration/__init__.py b/sdk/communication/azure-communication-administration/azure/communication/administration/__init__.py index af00af53f354..2864e79e5e5e 100644 --- a/sdk/communication/azure-communication-administration/azure/communication/administration/__init__.py +++ b/sdk/communication/azure-communication-administration/azure/communication/administration/__init__.py @@ -31,6 +31,7 @@ ReleaseResponse, UpdateNumberCapabilitiesResponse, UpdatePhoneNumberCapabilitiesResponse, + CreateSearchOptions ) from ._shared.models import ( @@ -66,6 +67,7 @@ 'ReleaseResponse', 'UpdateNumberCapabilitiesResponse', 'UpdatePhoneNumberCapabilitiesResponse', + 'CreateSearchOptions', # from _shared 'CommunicationUser', diff --git a/sdk/communication/azure-communication-administration/tests/phone_number_helper.py b/sdk/communication/azure-communication-administration/tests/phone_number_helper.py new file mode 100644 index 000000000000..445632f40c97 --- /dev/null +++ b/sdk/communication/azure-communication-administration/tests/phone_number_helper.py @@ -0,0 +1,26 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- +from azure_devtools.scenario_tests import RecordingProcessor + +class PhoneNumberUriReplacer(RecordingProcessor): + """Replace the identity in request uri""" + + def process_request(self, request): + import re + request.uri = re.sub('/identities/([^/?]+)', '/identities/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-administration/tests/recordings/test_phone_number_administration_client.test_cancel_search.yaml b/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client.test_cancel_search.yaml new file mode 100644 index 000000000000..16e182f33468 --- /dev/null +++ b/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client.test_cancel_search.yaml @@ -0,0 +1,36 @@ +interactions: +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Mon, 28 Sep 2020 21:07:45 GMT + User-Agent: + - azsdk-python-communication-administration/1.0.0b1 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/administration/phonenumbers/searches/search_id_to_cancel/cancel?api-version=2020-07-20-preview1 + response: + body: + string: '' + headers: + content-length: + - '0' + date: + - Mon, 28 Sep 2020 21:07:46 GMT + ms-cv: + - QzclZYQsuk2dhRGLgFRISw.0 + x-processing-time: + - 1272ms + status: + code: 202 + message: Accepted +version: 1 diff --git a/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client.test_configure_number.yaml b/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client.test_configure_number.yaml new file mode 100644 index 000000000000..8f491bb6ab4a --- /dev/null +++ b/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client.test_configure_number.yaml @@ -0,0 +1,39 @@ +interactions: +- request: + body: 'b''{"pstnConfiguration": {"callbackUrl": "https://callbackurl", "applicationId": + "ApplicationId", "azurePstnTargetId": "AzurePstnTargetId"}, "phoneNumber": "+1area_code_for_search4864953"}''' + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '168' + Content-Type: + - application/json + Date: + - Mon, 28 Sep 2020 20:52:31 GMT + User-Agent: + - azsdk-python-communication-administration/1.0.0b1 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/administration/phonenumbers/numberconfiguration/configure?api-version=2020-07-20-preview1 + response: + body: + string: '' + headers: + content-length: + - '0' + date: + - Mon, 28 Sep 2020 20:52:31 GMT + ms-cv: + - WNXx3LNakU6tV8xeGv33uA.0 + x-processing-time: + - 337ms + status: + code: 202 + message: Accepted +version: 1 diff --git a/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client.test_create_search.yaml b/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client.test_create_search.yaml new file mode 100644 index 000000000000..05ee0bd63076 --- /dev/null +++ b/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client.test_create_search.yaml @@ -0,0 +1,41 @@ +interactions: +- request: + body: 'b''b\''{"displayName": "testsearch20200014", "description": "testsearch20200014", + "phonePlanIds": ["phone_plan_id"], "areaCode": "area_code_for_search", "quantity": + 1}\''''' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '166' + Content-Type: + - application/json + Date: + - Mon, 28 Sep 2020 20:58:50 GMT + User-Agent: + - azsdk-python-communication-administration/1.0.0b1 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/administration/phonenumbers/searches?api-version=2020-07-20-preview1 + response: + body: '{"searchId": "sanitized"}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 28 Sep 2020 20:58:51 GMT + ms-cv: + - zBQqWRmiSEyC+AsrLoxytg.0 + transfer-encoding: + - chunked + x-processing-time: + - 1555ms + status: + code: 201 + message: Created +version: 1 diff --git a/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client.test_get_all_area_codes.yaml b/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client.test_get_all_area_codes.yaml new file mode 100644 index 000000000000..ac47214be402 --- /dev/null +++ b/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client.test_get_all_area_codes.yaml @@ -0,0 +1,39 @@ +interactions: +- request: + body: '{}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '2' + Content-Type: + - application/json + Date: + - Mon, 28 Sep 2020 20:52:31 GMT + User-Agent: + - azsdk-python-communication-administration/1.0.0b1 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/administration/phonenumbers/countries/US/areacodes?locationType=NotRequired&phonePlanId=phone_plan_id_area_codes&api-version=2020-07-20-preview1 + response: + body: '{"primaryAreaCodes": ["833"], "secondaryAreaCodes": [], "nextLink": null}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 28 Sep 2020 20:52:31 GMT + ms-cv: + - s1K8bpPuzUG5W6OtrZE6hw.0 + transfer-encoding: + - chunked + x-processing-time: + - 570ms + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client.test_get_capabilities_update.yaml b/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client.test_get_capabilities_update.yaml new file mode 100644 index 000000000000..daf8996d7d83 --- /dev/null +++ b/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client.test_get_capabilities_update.yaml @@ -0,0 +1,36 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Date: + - Mon, 28 Sep 2020 20:52:32 GMT + User-Agent: + - azsdk-python-communication-administration/1.0.0b1 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/administration/phonenumbers/capabilities/capabilities_id?api-version=2020-07-20-preview1 + response: + body: '{"capabilitiesUpdateId": "sanitized", "createdAt": "2020-09-28T17:49:13.2696607+00:00", + "capabilitiesUpdateStatus": "Complete", "phoneNumberCapabilitiesUpdates": "sanitized"}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 28 Sep 2020 20:52:32 GMT + ms-cv: + - T6S8W/xhekOa5x30VjpWOw.0 + transfer-encoding: + - chunked + x-processing-time: + - 562ms + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client.test_get_number_configuration.yaml b/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client.test_get_number_configuration.yaml new file mode 100644 index 000000000000..d5fc206076d1 --- /dev/null +++ b/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client.test_get_number_configuration.yaml @@ -0,0 +1,40 @@ +interactions: +- request: + body: 'b''{"phoneNumber": "+1area_code_for_search4864953"}''' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '31' + Content-Type: + - application/json + Date: + - Mon, 28 Sep 2020 20:52:33 GMT + User-Agent: + - azsdk-python-communication-administration/1.0.0b1 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/administration/phonenumbers/numberconfiguration?api-version=2020-07-20-preview1 + response: + body: '{"pstnConfiguration": {"callbackUrl": "https://callbackurl", "applicationId": + "ApplicationId", "azurePstnTargetId": "AzurePstnTargetId"}}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 28 Sep 2020 20:52:32 GMT + ms-cv: + - ISrlnWt250eHg9H0U7B6gA.0 + transfer-encoding: + - chunked + x-processing-time: + - 436ms + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client.test_get_phone_plan_location_options.yaml b/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client.test_get_phone_plan_location_options.yaml new file mode 100644 index 000000000000..912a36aa9f0a --- /dev/null +++ b/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client.test_get_phone_plan_location_options.yaml @@ -0,0 +1,250 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Date: + - Mon, 28 Sep 2020 20:52:34 GMT + User-Agent: + - azsdk-python-communication-administration/1.0.0b1 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/administration/phonenumbers/countries/US/phoneplangroups/phone_plan_group_id/phoneplans/phone_plan_id/locationoptions?locale=en-US&api-version=2020-07-20-preview1 + response: + body: '{"locationOptions": {"labelId": "state", "labelName": "State", "options": + [{"name": "AK", "value": "AK", "locationOptions": [{"labelId": "city", "labelName": + "City", "options": [{"name": "Anchorage", "value": "NOAM-US-AK-AN", "locationOptions": + []}]}]}, {"name": "AL", "value": "AL", "locationOptions": [{"labelId": "city", + "labelName": "City", "options": [{"name": "Birmingham", "value": "NOAM-US-AL-BI", + "locationOptions": []}, {"name": "Huntsville", "value": "NOAM-US-AL-HN", "locationOptions": + []}, {"name": "Mobile", "value": "NOAM-US-AL-MO", "locationOptions": []}, {"name": + "Montgomery", "value": "NOAM-US-AL-MN", "locationOptions": []}]}]}, {"name": + "AR", "value": "AR", "locationOptions": [{"labelId": "city", "labelName": "City", + "options": [{"name": "Fort Smith", "value": "NOAM-US-AR-FS", "locationOptions": + []}, {"name": "Jonesboro", "value": "NOAM-US-AR-JO", "locationOptions": []}, + {"name": "Little Rock", "value": "NOAM-US-AR-LR", "locationOptions": []}]}]}, + {"name": "AZ", "value": "AZ", "locationOptions": [{"labelId": "city", "labelName": + "City", "options": [{"name": "Phoenix", "value": "NOAM-US-AZ-PH", "locationOptions": + []}]}]}, {"name": "CA", "value": "CA", "locationOptions": [{"labelId": "city", + "labelName": "City", "options": [{"name": "Concord", "value": "NOAM-US-CA-CO", + "locationOptions": []}, {"name": "Fresno", "value": "NOAM-US-CA-FR", "locationOptions": + []}, {"name": "Irvine", "value": "NOAM-US-CA-IR", "locationOptions": []}, {"name": + "Los Angeles", "value": "NOAM-US-CA-LA", "locationOptions": []}, {"name": "Riverside", + "value": "NOAM-US-CA-RI", "locationOptions": []}, {"name": "Sacramento", "value": + "NOAM-US-CA-SA", "locationOptions": []}, {"name": "Salinas", "value": "NOAM-US-CA-SL", + "locationOptions": []}, {"name": "San Diego", "value": "NOAM-US-CA-SD", "locationOptions": + []}, {"name": "San Francisco", "value": "NOAM-US-CA-SF", "locationOptions": + []}, {"name": "San Jose", "value": "NOAM-US-CA-SJ", "locationOptions": []}, + {"name": "Santa Barbara", "value": "NOAM-US-CA-SB", "locationOptions": []}, + {"name": "Santa Clarita", "value": "NOAM-US-CA-SC", "locationOptions": []}, + {"name": "Santa Rosa", "value": "NOAM-US-CA-SR", "locationOptions": []}, {"name": + "Stockton", "value": "NOAM-US-CA-ST", "locationOptions": []}]}]}, {"name": "CL", + "value": "CL", "locationOptions": [{"labelId": "city", "labelName": "City", + "options": [{"name": "Washington DC", "value": "NOAM-US-CL-DC", "locationOptions": + []}]}]}, {"name": "CO", "value": "CO", "locationOptions": [{"labelId": "city", + "labelName": "City", "options": [{"name": "Denver", "value": "NOAM-US-CO-DE", + "locationOptions": []}, {"name": "Grand Junction", "value": "NOAM-US-CO-GJ", + "locationOptions": []}, {"name": "Pueblo", "value": "NOAM-US-CO-PU", "locationOptions": + []}]}]}, {"name": "CT", "value": "CT", "locationOptions": [{"labelId": "city", + "labelName": "City", "options": [{"name": "Bridgeport", "value": "NOAM-US-CT-BR", + "locationOptions": []}, {"name": "Hartford", "value": "NOAM-US-CT-HA", "locationOptions": + []}]}]}, {"name": "DE", "value": "DE", "locationOptions": [{"labelId": "city", + "labelName": "City", "options": [{"name": "Wilmington", "value": "NOAM-US-DE-WI", + "locationOptions": []}]}]}, {"name": "FL", "value": "FL", "locationOptions": + [{"labelId": "city", "labelName": "City", "options": [{"name": "Cape Coral", + "value": "NOAM-US-FL-CC", "locationOptions": []}, {"name": "Daytona Beach", + "value": "NOAM-US-FL-DB", "locationOptions": []}, {"name": "Gainesville", "value": + "NOAM-US-FL-GA", "locationOptions": []}, {"name": "Jacksonville", "value": "NOAM-US-FL-JA", + "locationOptions": []}, {"name": "Lakeland", "value": "NOAM-US-FL-LA", "locationOptions": + []}, {"name": "Miami", "value": "NOAM-US-FL-MI", "locationOptions": []}, {"name": + "Orlando", "value": "NOAM-US-FL-OR", "locationOptions": []}, {"name": "Port + St Lucie", "value": "NOAM-US-FL-PS", "locationOptions": []}, {"name": "Sarasota", + "value": "NOAM-US-FL-SA", "locationOptions": []}, {"name": "Tallahassee", "value": + "NOAM-US-FL-TA", "locationOptions": []}, {"name": "West Palm Beach", "value": + "NOAM-US-FL-WP", "locationOptions": []}]}]}, {"name": "GA", "value": "GA", "locationOptions": + [{"labelId": "city", "labelName": "City", "options": [{"name": "Albany", "value": + "NOAM-US-GA-AL", "locationOptions": []}, {"name": "Atlanta", "value": "NOAM-US-GA-AT", + "locationOptions": []}, {"name": "Augusta", "value": "NOAM-US-GA-AU", "locationOptions": + []}, {"name": "Macon", "value": "NOAM-US-GA-MA", "locationOptions": []}, {"name": + "Savannah", "value": "NOAM-US-GA-SA", "locationOptions": []}]}]}, {"name": "HI", + "value": "HI", "locationOptions": [{"labelId": "city", "labelName": "City", + "options": [{"name": "Honolulu", "value": "NOAM-US-HI-HO", "locationOptions": + []}]}]}, {"name": "IA", "value": "IA", "locationOptions": [{"labelId": "city", + "labelName": "City", "options": [{"name": "Cedar Rapids", "value": "NOAM-US-IA-CR", + "locationOptions": []}, {"name": "Davenport", "value": "NOAM-US-IA-DA", "locationOptions": + []}, {"name": "Mason City", "value": "NOAM-US-IA-MC", "locationOptions": []}]}]}, + {"name": "ID", "value": "ID", "locationOptions": [{"labelId": "city", "labelName": + "City", "options": [{"name": "Boise", "value": "NOAM-US-ID-BO", "locationOptions": + []}]}]}, {"name": "IL", "value": "IL", "locationOptions": [{"labelId": "city", + "labelName": "City", "options": [{"name": "Alton", "value": "NOAM-US-IL-AL", + "locationOptions": []}, {"name": "Aurora", "value": "NOAM-US-IL-AU", "locationOptions": + []}, {"name": "Big Rock", "value": "NOAM-US-IL-BK", "locationOptions": []}, + {"name": "Champaign", "value": "NOAM-US-IL-CA", "locationOptions": []}, {"name": + "Chicago", "value": "NOAM-US-IL-CH", "locationOptions": []}, {"name": "Cicero", + "value": "NOAM-US-IL-CI", "locationOptions": []}, {"name": "Rock Island", "value": + "NOAM-US-IL-RI", "locationOptions": []}, {"name": "Waukegan", "value": "NOAM-US-IL-WK", + "locationOptions": []}]}]}, {"name": "IN", "value": "IN", "locationOptions": + [{"labelId": "city", "labelName": "City", "options": [{"name": "Evansville", + "value": "NOAM-US-IN-EV", "locationOptions": []}, {"name": "Fort Wayne", "value": + "NOAM-US-IN-FW", "locationOptions": []}, {"name": "Gary", "value": "NOAM-US-IN-GA", + "locationOptions": []}, {"name": "Indianapolis", "value": "NOAM-US-IN-IN", "locationOptions": + []}, {"name": "South Bend", "value": "NOAM-US-IN-SB", "locationOptions": []}]}]}, + {"name": "KS", "value": "KS", "locationOptions": [{"labelId": "city", "labelName": + "City", "options": [{"name": "Dodge City", "value": "NOAM-US-KS-DC", "locationOptions": + []}, {"name": "Kansas City", "value": "NOAM-US-KS-KS", "locationOptions": []}, + {"name": "Topeka", "value": "NOAM-US-KS-TO", "locationOptions": []}, {"name": + "Wichita", "value": "NOAM-US-KS-WI", "locationOptions": []}]}]}, {"name": "KY", + "value": "KY", "locationOptions": [{"labelId": "city", "labelName": "City", + "options": [{"name": "Ashland", "value": "NOAM-US-KY-AS", "locationOptions": + []}, {"name": "Lexington", "value": "NOAM-US-KY-LE", "locationOptions": []}, + {"name": "Louisville", "value": "NOAM-US-KY-LO", "locationOptions": []}]}]}, + {"name": "LA", "value": "LA", "locationOptions": [{"labelId": "city", "labelName": + "City", "options": [{"name": "Baton Rouge", "value": "NOAM-US-LA-BR", "locationOptions": + []}, {"name": "Lafayette", "value": "NOAM-US-LA-LA", "locationOptions": []}, + {"name": "New Orleans", "value": "NOAM-US-LA-NO", "locationOptions": []}, {"name": + "Shreveport", "value": "NOAM-US-LA-SH", "locationOptions": []}]}]}, {"name": + "MA", "value": "MA", "locationOptions": [{"labelId": "city", "labelName": "City", + "options": [{"name": "Chicopee", "value": "NOAM-US-MA-CH", "locationOptions": + []}]}]}, {"name": "MD", "value": "MD", "locationOptions": [{"labelId": "city", + "labelName": "City", "options": [{"name": "Bethesda", "value": "NOAM-US-MD-BE", + "locationOptions": []}]}]}, {"name": "ME", "value": "ME", "locationOptions": + [{"labelId": "city", "labelName": "City", "options": [{"name": "Portland", "value": + "NOAM-US-ME-PO", "locationOptions": []}]}]}, {"name": "MI", "value": "MI", "locationOptions": + [{"labelId": "city", "labelName": "City", "options": [{"name": "Detroit", "value": + "NOAM-US-MI-DE", "locationOptions": []}, {"name": "Flint", "value": "NOAM-US-MI-FL", + "locationOptions": []}, {"name": "Grand Rapids", "value": "NOAM-US-MI-GP", "locationOptions": + []}, {"name": "Grant", "value": "NOAM-US-MI-GR", "locationOptions": []}, {"name": + "Lansing", "value": "NOAM-US-MI-LA", "locationOptions": []}, {"name": "Saginaw", + "value": "NOAM-US-MI-SA", "locationOptions": []}, {"name": "Sault Ste Marie", + "value": "NOAM-US-MI-SS", "locationOptions": []}, {"name": "Troy", "value": + "NOAM-US-MI-TR", "locationOptions": []}]}]}, {"name": "MN", "value": "MN", "locationOptions": + [{"labelId": "city", "labelName": "City", "options": [{"name": "Alexandria", + "value": "NOAM-US-MN-AL", "locationOptions": []}, {"name": "Duluth", "value": + "NOAM-US-MN-DU", "locationOptions": []}, {"name": "Minneapolis", "value": "NOAM-US-MN-MI", + "locationOptions": []}, {"name": "St. Paul", "value": "NOAM-US-MN-SP", "locationOptions": + []}]}]}, {"name": "MO", "value": "MO", "locationOptions": [{"labelId": "city", + "labelName": "City", "options": [{"name": "Columbia", "value": "NOAM-US-MO-CO", + "locationOptions": []}, {"name": "Kansas City", "value": "NOAM-US-MO-KS", "locationOptions": + []}, {"name": "Marshall", "value": "NOAM-US-MO-MA", "locationOptions": []}, + {"name": "Springfield", "value": "NOAM-US-MO-SP", "locationOptions": []}, {"name": + "St. Charles", "value": "NOAM-US-MO-SC", "locationOptions": []}, {"name": "St. + Louis", "value": "NOAM-US-MO-SL", "locationOptions": []}]}]}, {"name": "MS", + "value": "MS", "locationOptions": [{"labelId": "city", "labelName": "City", + "options": [{"name": "Biloxi", "value": "NOAM-US-MS-BI", "locationOptions": + []}, {"name": "Jackson", "value": "NOAM-US-MS-JA", "locationOptions": []}, {"name": + "Starkville", "value": "NOAM-US-MS-ST", "locationOptions": []}]}]}, {"name": + "MT", "value": "MT", "locationOptions": [{"labelId": "city", "labelName": "City", + "options": [{"name": "Billings", "value": "NOAM-US-MT-BI", "locationOptions": + []}]}]}, {"name": "NC", "value": "NC", "locationOptions": [{"labelId": "city", + "labelName": "City", "options": [{"name": "Charlotte", "value": "NOAM-US-NC-CH", + "locationOptions": []}, {"name": "Fayetteville", "value": "NOAM-US-NC-FA", "locationOptions": + []}, {"name": "Greensboro", "value": "NOAM-US-NC-GR", "locationOptions": []}, + {"name": "Raleigh", "value": "NOAM-US-NC-RA", "locationOptions": []}]}]}, {"name": + "NE", "value": "NE", "locationOptions": [{"labelId": "city", "labelName": "City", + "options": [{"name": "Kearney", "value": "NOAM-US-NE-KE", "locationOptions": + []}, {"name": "Omaha", "value": "NOAM-US-NE-OM", "locationOptions": []}]}]}, + {"name": "NJ", "value": "NJ", "locationOptions": [{"labelId": "city", "labelName": + "City", "options": [{"name": "Atlantic City", "value": "NOAM-US-NJ-AC", "locationOptions": + []}, {"name": "Camden", "value": "NOAM-US-NJ-CA", "locationOptions": []}, {"name": + "Newark", "value": "NOAM-US-NJ-NE", "locationOptions": []}]}]}, {"name": "NM", + "value": "NM", "locationOptions": [{"labelId": "city", "labelName": "City", + "options": [{"name": "Las Cruces", "value": "NOAM-US-NM-LC", "locationOptions": + []}]}]}, {"name": "NV", "value": "NV", "locationOptions": [{"labelId": "city", + "labelName": "City", "options": [{"name": "Las Vegas", "value": "NOAM-US-NV-LV", + "locationOptions": []}, {"name": "Reno", "value": "NOAM-US-NV-RE", "locationOptions": + []}]}]}, {"name": "NY", "value": "NY", "locationOptions": [{"labelId": "city", + "labelName": "City", "options": [{"name": "Albany", "value": "NOAM-US-NY-AL", + "locationOptions": []}, {"name": "Brentwood", "value": "NOAM-US-NY-BR", "locationOptions": + []}, {"name": "Elmira", "value": "NOAM-US-NY-EL", "locationOptions": []}, {"name": + "Hempstead", "value": "NOAM-US-NY-HE", "locationOptions": []}, {"name": "Kingston", + "value": "NOAM-US-NY-KI", "locationOptions": []}, {"name": "New York City", + "value": "NOAM-US-NY-NY", "locationOptions": []}, {"name": "Niagara Falls", + "value": "NOAM-US-NY-NF", "locationOptions": []}, {"name": "Rochester", "value": + "NOAM-US-NY-RO", "locationOptions": []}, {"name": "Syracuse", "value": "NOAM-US-NY-SY", + "locationOptions": []}, {"name": "Yonkers", "value": "NOAM-US-NY-YO", "locationOptions": + []}]}]}, {"name": "OH", "value": "OH", "locationOptions": [{"labelId": "city", + "labelName": "City", "options": [{"name": "Akron", "value": "NOAM-US-OH-AK", + "locationOptions": []}, {"name": "Cincinnati", "value": "NOAM-US-OH-CI", "locationOptions": + []}, {"name": "Columbus", "value": "NOAM-US-OH-CO", "locationOptions": []}, + {"name": "Dayton", "value": "NOAM-US-OH-DA", "locationOptions": []}, {"name": + "Toledo", "value": "NOAM-US-OH-TO", "locationOptions": []}]}]}, {"name": "OK", + "value": "OK", "locationOptions": [{"labelId": "city", "labelName": "City", + "options": [{"name": "Lawton", "value": "NOAM-US-OK-LA", "locationOptions": + []}, {"name": "Oklahoma City", "value": "NOAM-US-OK-OC", "locationOptions": + []}, {"name": "Tulsa", "value": "NOAM-US-OK-TU", "locationOptions": []}]}]}, + {"name": "PA", "value": "PA", "locationOptions": [{"labelId": "city", "labelName": + "City", "options": [{"name": "Erie", "value": "NOAM-US-PA-ER", "locationOptions": + []}, {"name": "Lancaster", "value": "NOAM-US-PA-LA", "locationOptions": []}, + {"name": "New Castle", "value": "NOAM-US-PA-NC", "locationOptions": []}, {"name": + "Philadelphia", "value": "NOAM-US-PA-PI", "locationOptions": []}, {"name": "Pittsburgh", + "value": "NOAM-US-PA-PT", "locationOptions": []}, {"name": "Scranton", "value": + "NOAM-US-PA-SC", "locationOptions": []}]}]}, {"name": "RI", "value": "RI", "locationOptions": + [{"labelId": "city", "labelName": "City", "options": [{"name": "Providence", + "value": "NOAM-US-RI-PR", "locationOptions": []}]}]}, {"name": "SC", "value": + "SC", "locationOptions": [{"labelId": "city", "labelName": "City", "options": + [{"name": "Charleston", "value": "NOAM-US-SC-CH", "locationOptions": []}, {"name": + "Columbia", "value": "NOAM-US-SC-CO", "locationOptions": []}, {"name": "Greenville", + "value": "NOAM-US-SC-GR", "locationOptions": []}]}]}, {"name": "SD", "value": + "SD", "locationOptions": [{"labelId": "city", "labelName": "City", "options": + [{"name": "Sioux Falls", "value": "NOAM-US-SD-SF", "locationOptions": []}]}]}, + {"name": "TN", "value": "TN", "locationOptions": [{"labelId": "city", "labelName": + "City", "options": [{"name": "Chattanooga", "value": "NOAM-US-TN-CH", "locationOptions": + []}, {"name": "Clarksville", "value": "NOAM-US-TN-CL", "locationOptions": []}, + {"name": "Jackson", "value": "NOAM-US-TN-JA", "locationOptions": []}, {"name": + "Knoxville", "value": "NOAM-US-TN-KN", "locationOptions": []}, {"name": "Memphis", + "value": "NOAM-US-TN-ME", "locationOptions": []}, {"name": "Nashville", "value": + "NOAM-US-TN-NA", "locationOptions": []}]}]}, {"name": "TX", "value": "TX", "locationOptions": + [{"labelId": "city", "labelName": "City", "options": [{"name": "Austin", "value": + "NOAM-US-TX-AU", "locationOptions": []}, {"name": "Corpus Christi", "value": + "NOAM-US-TX-CC", "locationOptions": []}, {"name": "Denton", "value": "NOAM-US-TX-DE", + "locationOptions": []}, {"name": "El Paso", "value": "NOAM-US-TX-EP", "locationOptions": + []}, {"name": "Fort Worth", "value": "NOAM-US-TX-FW", "locationOptions": []}, + {"name": "Galveston", "value": "NOAM-US-TX-GA", "locationOptions": []}, {"name": + "Houston", "value": "NOAM-US-TX-HO", "locationOptions": []}, {"name": "Lubbock", + "value": "NOAM-US-TX-LU", "locationOptions": []}, {"name": "Odessa", "value": + "NOAM-US-TX-OD", "locationOptions": []}, {"name": "Tyler", "value": "NOAM-US-TX-TY", + "locationOptions": []}]}]}, {"name": "UT", "value": "UT", "locationOptions": + [{"labelId": "city", "labelName": "City", "options": [{"name": "Salt Lake City", + "value": "NOAM-US-UT-SL", "locationOptions": []}, {"name": "St. George", "value": + "NOAM-US-UT-SG", "locationOptions": []}]}]}, {"name": "VA", "value": "VA", "locationOptions": + [{"labelId": "city", "labelName": "City", "options": [{"name": "Lynchburg", + "value": "NOAM-US-VA-LY", "locationOptions": []}, {"name": "Richmond", "value": + "NOAM-US-VA-RI", "locationOptions": []}, {"name": "Virginia Beach", "value": + "NOAM-US-VA-VB", "locationOptions": []}]}]}, {"name": "VT", "value": "VT", "locationOptions": + [{"labelId": "city", "labelName": "City", "options": [{"name": "Bennington", + "value": "NOAM-US-VT-BE", "locationOptions": []}, {"name": "Brattleboro", "value": + "NOAM-US-VT-BR", "locationOptions": []}, {"name": "Burlington", "value": "NOAM-US-VT-BU", + "locationOptions": []}, {"name": "Middlebury", "value": "NOAM-US-VT-MB", "locationOptions": + []}, {"name": "Montpelier", "value": "NOAM-US-VT-MP", "locationOptions": []}, + {"name": "Newport", "value": "NOAM-US-VT-NE", "locationOptions": []}]}]}, {"name": + "WI", "value": "WI", "locationOptions": [{"labelId": "city", "labelName": "City", + "options": [{"name": "Green Bay", "value": "NOAM-US-WI-GB", "locationOptions": + []}, {"name": "Kenosha", "value": "NOAM-US-WI-KE", "locationOptions": []}, {"name": + "Madison", "value": "NOAM-US-WI-MA", "locationOptions": []}, {"name": "Milwaukee", + "value": "NOAM-US-WI-MI", "locationOptions": []}]}]}, {"name": "WV", "value": + "WV", "locationOptions": [{"labelId": "city", "labelName": "City", "options": + [{"name": "Charleston", "value": "NOAM-US-WV-CH", "locationOptions": []}]}]}, + {"name": "WY", "value": "WY", "locationOptions": [{"labelId": "city", "labelName": + "City", "options": [{"name": "Laramie", "value": "NOAM-US-WY-LA", "locationOptions": + []}]}]}]}}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 28 Sep 2020 20:52:34 GMT + ms-cv: + - TCixofN+fEuJbhQiyFlpQw.0 + transfer-encoding: + - chunked + x-processing-time: + - 787ms + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client.test_get_release_by_id.yaml b/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client.test_get_release_by_id.yaml new file mode 100644 index 000000000000..7f9cbf2b510a --- /dev/null +++ b/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client.test_get_release_by_id.yaml @@ -0,0 +1,37 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Date: + - Mon, 28 Sep 2020 20:52:35 GMT + User-Agent: + - azsdk-python-communication-administration/1.0.0b1 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/administration/phonenumbers/releases/release_id?api-version=2020-07-20-preview1 + response: + body: '{"releaseId": "sanitized", "createdAt": "2020-09-28T20:09:36.2701214+00:00", + "status": "Failed", "errorMessage": "All numbers in Failed state after BVD call", + "phoneNumberReleaseStatusDetails": "sanitized"}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 28 Sep 2020 20:52:35 GMT + ms-cv: + - aDDYFuvWA0C5m8vxbQZa7g.0 + transfer-encoding: + - chunked + x-processing-time: + - 350ms + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client.test_get_search_by_id.yaml b/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client.test_get_search_by_id.yaml new file mode 100644 index 000000000000..ffde5892579c --- /dev/null +++ b/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client.test_get_search_by_id.yaml @@ -0,0 +1,39 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Date: + - Mon, 28 Sep 2020 20:52:36 GMT + User-Agent: + - azsdk-python-communication-administration/1.0.0b1 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/administration/phonenumbers/searches/search_id?api-version=2020-07-20-preview1 + response: + body: '{"searchId": "sanitized", "displayName": "mysearch20200928", "createdAt": + "2020-09-28T19:51:03.7045074+00:00", "description": "mydescription", "phonePlanIds": + "sanitized", "areaCode": "area_code_for_search", "quantity": 1, "locationOptions": + [], "status": "Error", "phoneNumbers": "sanitized", "reservationExpiryDate": + "2020-09-28T20:07:15.1891834+00:00", "errorCode": 1011}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 28 Sep 2020 20:52:36 GMT + ms-cv: + - rR2LYefRZUqEC64QM4XUtA.0 + transfer-encoding: + - chunked + x-processing-time: + - 540ms + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client.test_list_all_phone_numbers.yaml b/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client.test_list_all_phone_numbers.yaml new file mode 100644 index 000000000000..e2dc5adaffd9 --- /dev/null +++ b/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client.test_list_all_phone_numbers.yaml @@ -0,0 +1,35 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Date: + - Mon, 28 Sep 2020 20:52:36 GMT + User-Agent: + - azsdk-python-communication-administration/1.0.0b1 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/administration/phonenumbers/phonenumbers?locale=en-US&skip=0&take=100&api-version=2020-07-20-preview1 + response: + body: '{"phoneNumbers": "sanitized", "nextLink": null}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 28 Sep 2020 20:52:36 GMT + ms-cv: + - ZrnIo+1IWUm2rr4BXwpD9Q.0 + transfer-encoding: + - chunked + x-processing-time: + - 621ms + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client.test_list_all_releases.yaml b/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client.test_list_all_releases.yaml new file mode 100644 index 000000000000..5a2fdf532df1 --- /dev/null +++ b/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client.test_list_all_releases.yaml @@ -0,0 +1,35 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Date: + - Mon, 28 Sep 2020 20:52:37 GMT + User-Agent: + - azsdk-python-communication-administration/1.0.0b1 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/administration/phonenumbers/releases?skip=0&take=100&api-version=2020-07-20-preview1 + response: + body: '{"entities": "sanitized", "nextLink": null}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 28 Sep 2020 20:52:37 GMT + ms-cv: + - O7UjJU4tlkuR+ohvj2AJWw.0 + transfer-encoding: + - chunked + x-processing-time: + - 507ms + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client.test_list_all_supported_countries.yaml b/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client.test_list_all_supported_countries.yaml new file mode 100644 index 000000000000..b3b529132fe2 --- /dev/null +++ b/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client.test_list_all_supported_countries.yaml @@ -0,0 +1,37 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Date: + - Mon, 28 Sep 2020 20:52:38 GMT + User-Agent: + - azsdk-python-communication-administration/1.0.0b1 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/administration/phonenumbers/countries?locale=en-US&skip=0&take=100&api-version=2020-07-20-preview1 + response: + body: '{"countries": [{"localizedName": "Australia", "countryCode": "AU"}, {"localizedName": + "Japan", "countryCode": "JP"}, {"localizedName": "United States", "countryCode": + "US"}], "nextLink": null}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 28 Sep 2020 20:52:39 GMT + ms-cv: + - lTXki58ix0GoWp1Q+s7suw.0 + transfer-encoding: + - chunked + x-processing-time: + - 747ms + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client.test_list_phone_plan_groups.yaml b/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client.test_list_phone_plan_groups.yaml new file mode 100644 index 000000000000..c64cf8f9b087 --- /dev/null +++ b/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client.test_list_phone_plan_groups.yaml @@ -0,0 +1,35 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Date: + - Mon, 28 Sep 2020 20:52:39 GMT + User-Agent: + - azsdk-python-communication-administration/1.0.0b1 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/administration/phonenumbers/countries/US/phoneplangroups?locale=en-US&includeRateInformation=false&skip=0&take=100&api-version=2020-07-20-preview1 + response: + body: '{"phonePlanGroups": "sanitized", "nextLink": null}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 28 Sep 2020 20:52:40 GMT + ms-cv: + - CV4dPbtIc0KVqCsKbegUFw.0 + transfer-encoding: + - chunked + x-processing-time: + - 600ms + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client.test_list_phone_plans.yaml b/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client.test_list_phone_plans.yaml new file mode 100644 index 000000000000..4161b96c1d4e --- /dev/null +++ b/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client.test_list_phone_plans.yaml @@ -0,0 +1,35 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Date: + - Mon, 28 Sep 2020 20:52:40 GMT + User-Agent: + - azsdk-python-communication-administration/1.0.0b1 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/administration/phonenumbers/countries/US/phoneplangroups/phone_plan_group_id/phoneplans?locale=en-US&skip=0&take=100&api-version=2020-07-20-preview1 + response: + body: '{"phonePlans": "sanitized", "nextLink": null}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 28 Sep 2020 20:52:40 GMT + ms-cv: + - hM4twEJ1hkelj8JvXL9vbA.0 + transfer-encoding: + - chunked + x-processing-time: + - 545ms + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client.test_purchase_search.yaml b/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client.test_purchase_search.yaml new file mode 100644 index 000000000000..b0c435a51250 --- /dev/null +++ b/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client.test_purchase_search.yaml @@ -0,0 +1,36 @@ +interactions: +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Date: + - Mon, 28 Sep 2020 21:05:56 GMT + User-Agent: + - azsdk-python-communication-administration/1.0.0b1 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/administration/phonenumbers/searches/search_id_to_purchase/purchase?api-version=2020-07-20-preview1 + response: + body: + string: '' + headers: + content-length: + - '0' + date: + - Mon, 28 Sep 2020 21:05:56 GMT + ms-cv: + - xwaQWMyPXkmZISlt39/8sQ.0 + x-processing-time: + - 1104ms + status: + code: 202 + message: Accepted +version: 1 diff --git a/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client.test_update_capabilities.yaml b/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client.test_update_capabilities.yaml new file mode 100644 index 000000000000..2841aff8d502 --- /dev/null +++ b/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client.test_update_capabilities.yaml @@ -0,0 +1,40 @@ +interactions: +- request: + body: 'b''{"phoneNumberCapabilitiesUpdate": {"+1area_code_for_search4864953": + {"add": []}}}''' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '64' + Content-Type: + - application/json + Date: + - Mon, 28 Sep 2020 20:52:41 GMT + User-Agent: + - azsdk-python-communication-administration/1.0.0b1 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/administration/phonenumbers/capabilities?api-version=2020-07-20-preview1 + response: + body: '{"capabilitiesUpdateId": "sanitized"}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 28 Sep 2020 20:52:42 GMT + ms-cv: + - 2wG6ECtNVUWh9yTw1e0F1Q.0 + transfer-encoding: + - chunked + x-processing-time: + - 882ms + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client_async.test_cancel_search.yaml b/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client_async.test_cancel_search.yaml new file mode 100644 index 000000000000..b1c09cffa120 --- /dev/null +++ b/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client_async.test_cancel_search.yaml @@ -0,0 +1,25 @@ +interactions: +- request: + body: '' + headers: + Date: + - Mon, 28 Sep 2020 22:29:32 GMT + User-Agent: + - azsdk-python-communication-administration/1.0.0b1 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/administration/phonenumbers/searches/search_id/cancel?api-version=2020-07-20-preview1 + response: + body: + string: '' + headers: + content-length: '0' + date: Mon, 28 Sep 2020 22:29:33 GMT + ms-cv: Br5JTlNBNE66iA7S70L1xg.0 + x-processing-time: 894ms + status: + code: 202 + message: Accepted + url: https://sanitized.communication.azure.com/administration/phonenumbers/searches/sanitized/cancel?api-version=2020-07-20-preview1 +version: 1 diff --git a/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client_async.test_configure_number.yaml b/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client_async.test_configure_number.yaml new file mode 100644 index 000000000000..54437a5a0e4d --- /dev/null +++ b/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client_async.test_configure_number.yaml @@ -0,0 +1,30 @@ +interactions: +- request: + body: 'b''{"pstnConfiguration": {"callbackUrl": "https://callbackurl", "applicationId": + "ApplicationId", "azurePstnTargetId": "AzurePstnTargetId"}, "phoneNumber": "+1area_code_for_search4866306"}''' + headers: + Content-Length: + - '168' + Content-Type: + - application/json + Date: + - Mon, 28 Sep 2020 23:36:20 GMT + User-Agent: + - azsdk-python-communication-administration/1.0.0b1 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/administration/phonenumbers/numberconfiguration/configure?api-version=2020-07-20-preview1 + response: + body: + string: '' + headers: + content-length: '0' + date: Mon, 28 Sep 2020 23:36:22 GMT + ms-cv: DaWW0P2dX0uW3zxujdXNZQ.0 + x-processing-time: 2855ms + status: + code: 202 + message: Accepted + url: https://sanitized.communication.azure.com/administration/phonenumbers/numberconfiguration/configure?api-version=2020-07-20-preview1 +version: 1 diff --git a/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client_async.test_create_search.yaml b/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client_async.test_create_search.yaml new file mode 100644 index 000000000000..e22e20d79e0c --- /dev/null +++ b/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client_async.test_create_search.yaml @@ -0,0 +1,33 @@ +interactions: +- request: + body: 'b''b\''{"displayName": "testsearch20200014", "description": "testsearch20200014", + "phonePlanIds": ["phone_plan_id"], "areaCode": "area_code_for_search", "quantity": + 1}\''''' + headers: + Accept: + - application/json + Content-Length: + - '166' + Content-Type: + - application/json + Date: + - Mon, 28 Sep 2020 23:41:10 GMT + User-Agent: + - azsdk-python-communication-administration/1.0.0b1 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/administration/phonenumbers/searches?api-version=2020-07-20-preview1 + response: + body: '{"searchId": "sanitized"}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 28 Sep 2020 23:41:11 GMT + ms-cv: GgMka9ljgU6YI/sJAkla6A.0 + transfer-encoding: chunked + x-processing-time: 2452ms + status: + code: 201 + message: Created + url: https://sanitized.communication.azure.com/administration/phonenumbers/searches?api-version=2020-07-20-preview1 +version: 1 diff --git a/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client_async.test_get_all_area_codes.yaml b/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client_async.test_get_all_area_codes.yaml new file mode 100644 index 000000000000..c7b1ea1b95c0 --- /dev/null +++ b/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client_async.test_get_all_area_codes.yaml @@ -0,0 +1,31 @@ +interactions: +- request: + body: '{}' + headers: + Accept: + - application/json + Content-Length: + - '2' + Content-Type: + - application/json + Date: + - Mon, 28 Sep 2020 23:36:23 GMT + User-Agent: + - azsdk-python-communication-administration/1.0.0b1 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/administration/phonenumbers/countries/US/areacodes?locationType=NotRequired&phonePlanId=phone_plan_id_area_codes&api-version=2020-07-20-preview1 + response: + body: '{"primaryAreaCodes": ["833"], "secondaryAreaCodes": [], "nextLink": null}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 28 Sep 2020 23:36:24 GMT + ms-cv: xH2LI3yX8Uq7vldnjshP0g.0 + transfer-encoding: chunked + x-processing-time: 762ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/administration/phonenumbers/countries/US/areacodes?locationType=NotRequired&phonePlanId=sanitized&api-version=2020-07-20-preview1 +version: 1 diff --git a/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client_async.test_get_capabilities_update.yaml b/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client_async.test_get_capabilities_update.yaml new file mode 100644 index 000000000000..5bb55438d9d3 --- /dev/null +++ b/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client_async.test_get_capabilities_update.yaml @@ -0,0 +1,28 @@ +interactions: +- request: + body: '' + headers: + Accept: + - application/json + Date: + - Mon, 28 Sep 2020 23:36:24 GMT + User-Agent: + - azsdk-python-communication-administration/1.0.0b1 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/administration/phonenumbers/capabilities/capabilities_id?api-version=2020-07-20-preview1 + response: + body: '{"capabilitiesUpdateId": "sanitized", "createdAt": "2020-09-28T17:49:13.2696607+00:00", + "capabilitiesUpdateStatus": "Complete", "phoneNumberCapabilitiesUpdates": "sanitized"}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 28 Sep 2020 23:36:25 GMT + ms-cv: LDKKttbI10OoFujUhG/HEw.0 + transfer-encoding: chunked + x-processing-time: 936ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/administration/phonenumbers/capabilities/sanitized?api-version=2020-07-20-preview1 +version: 1 diff --git a/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client_async.test_get_number_configuration.yaml b/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client_async.test_get_number_configuration.yaml new file mode 100644 index 000000000000..28d480278262 --- /dev/null +++ b/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client_async.test_get_number_configuration.yaml @@ -0,0 +1,61 @@ +interactions: +- request: + body: 'b''{"phoneNumber": "+1area_code_for_search4866306"}''' + headers: + Accept: + - application/json + Content-Length: + - '31' + Content-Type: + - application/json + Date: + - Mon, 28 Sep 2020 23:36:26 GMT + User-Agent: + - azsdk-python-communication-administration/1.0.0b1 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/administration/phonenumbers/numberconfiguration?api-version=2020-07-20-preview1 + response: + body: + string: '' + headers: + content-length: '0' + date: Mon, 28 Sep 2020 23:36:35 GMT + ms-cv: qMAd5RJcGUScTUQawpDqaA.0 + x-processing-time: 9353ms + status: + code: 500 + message: Internal Server Error + url: https://sanitized.communication.azure.com/administration/phonenumbers/numberconfiguration?api-version=2020-07-20-preview1 +- request: + body: 'b''{"phoneNumber": "+1area_code_for_search4866306"}''' + headers: + Accept: + - application/json + Content-Length: + - '31' + Content-Type: + - application/json + Date: + - Mon, 28 Sep 2020 23:36:35 GMT + User-Agent: + - azsdk-python-communication-administration/1.0.0b1 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/administration/phonenumbers/numberconfiguration?api-version=2020-07-20-preview1 + response: + body: '{"pstnConfiguration": {"callbackUrl": "https://callbackurl", "applicationId": + "ApplicationId", "azurePstnTargetId": "AzurePstnTargetId"}}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 28 Sep 2020 23:36:40 GMT + ms-cv: oSC8jj4poEK70ADvTtkOAA.0 + transfer-encoding: chunked + x-processing-time: 5461ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/administration/phonenumbers/numberconfiguration?api-version=2020-07-20-preview1 +version: 1 diff --git a/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client_async.test_get_phone_plan_location_options.yaml b/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client_async.test_get_phone_plan_location_options.yaml new file mode 100644 index 000000000000..647556757ed4 --- /dev/null +++ b/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client_async.test_get_phone_plan_location_options.yaml @@ -0,0 +1,240 @@ +interactions: +- request: + body: '' + headers: + Accept: + - application/json + Date: + - Mon, 28 Sep 2020 23:36:41 GMT + User-Agent: + - azsdk-python-communication-administration/1.0.0b1 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/administration/phonenumbers/countries/US/phoneplangroups/phone_plan_group_id/phoneplans/phone_plan_id/locationoptions?locale=en-US&api-version=2020-07-20-preview1 + response: + body: '{"locationOptions": {"labelId": "state", "labelName": "State", "options": + [{"name": "AK", "value": "AK", "locationOptions": [{"labelId": "city", "labelName": + "City", "options": [{"name": "Anchorage", "value": "NOAM-US-AK-AN", "locationOptions": + []}]}]}, {"name": "AL", "value": "AL", "locationOptions": [{"labelId": "city", + "labelName": "City", "options": [{"name": "Birmingham", "value": "NOAM-US-AL-BI", + "locationOptions": []}, {"name": "Huntsville", "value": "NOAM-US-AL-HN", "locationOptions": + []}, {"name": "Mobile", "value": "NOAM-US-AL-MO", "locationOptions": []}, {"name": + "Montgomery", "value": "NOAM-US-AL-MN", "locationOptions": []}]}]}, {"name": + "AR", "value": "AR", "locationOptions": [{"labelId": "city", "labelName": "City", + "options": [{"name": "Fort Smith", "value": "NOAM-US-AR-FS", "locationOptions": + []}, {"name": "Jonesboro", "value": "NOAM-US-AR-JO", "locationOptions": []}, + {"name": "Little Rock", "value": "NOAM-US-AR-LR", "locationOptions": []}]}]}, + {"name": "AZ", "value": "AZ", "locationOptions": [{"labelId": "city", "labelName": + "City", "options": [{"name": "Phoenix", "value": "NOAM-US-AZ-PH", "locationOptions": + []}]}]}, {"name": "CA", "value": "CA", "locationOptions": [{"labelId": "city", + "labelName": "City", "options": [{"name": "Concord", "value": "NOAM-US-CA-CO", + "locationOptions": []}, {"name": "Fresno", "value": "NOAM-US-CA-FR", "locationOptions": + []}, {"name": "Irvine", "value": "NOAM-US-CA-IR", "locationOptions": []}, {"name": + "Los Angeles", "value": "NOAM-US-CA-LA", "locationOptions": []}, {"name": "Riverside", + "value": "NOAM-US-CA-RI", "locationOptions": []}, {"name": "Sacramento", "value": + "NOAM-US-CA-SA", "locationOptions": []}, {"name": "Salinas", "value": "NOAM-US-CA-SL", + "locationOptions": []}, {"name": "San Diego", "value": "NOAM-US-CA-SD", "locationOptions": + []}, {"name": "San Jose", "value": "NOAM-US-CA-SJ", "locationOptions": []}, + {"name": "Santa Barbara", "value": "NOAM-US-CA-SB", "locationOptions": []}, + {"name": "Santa Clarita", "value": "NOAM-US-CA-SC", "locationOptions": []}, + {"name": "Santa Rosa", "value": "NOAM-US-CA-SR", "locationOptions": []}, {"name": + "Stockton", "value": "NOAM-US-CA-ST", "locationOptions": []}]}]}, {"name": "CL", + "value": "CL", "locationOptions": [{"labelId": "city", "labelName": "City", + "options": [{"name": "Washington DC", "value": "NOAM-US-CL-DC", "locationOptions": + []}]}]}, {"name": "CO", "value": "CO", "locationOptions": [{"labelId": "city", + "labelName": "City", "options": [{"name": "Denver", "value": "NOAM-US-CO-DE", + "locationOptions": []}, {"name": "Grand Junction", "value": "NOAM-US-CO-GJ", + "locationOptions": []}, {"name": "Pueblo", "value": "NOAM-US-CO-PU", "locationOptions": + []}]}]}, {"name": "CT", "value": "CT", "locationOptions": [{"labelId": "city", + "labelName": "City", "options": [{"name": "Bridgeport", "value": "NOAM-US-CT-BR", + "locationOptions": []}, {"name": "Hartford", "value": "NOAM-US-CT-HA", "locationOptions": + []}]}]}, {"name": "DE", "value": "DE", "locationOptions": [{"labelId": "city", + "labelName": "City", "options": [{"name": "Wilmington", "value": "NOAM-US-DE-WI", + "locationOptions": []}]}]}, {"name": "FL", "value": "FL", "locationOptions": + [{"labelId": "city", "labelName": "City", "options": [{"name": "Cape Coral", + "value": "NOAM-US-FL-CC", "locationOptions": []}, {"name": "Gainesville", "value": + "NOAM-US-FL-GA", "locationOptions": []}, {"name": "Jacksonville", "value": "NOAM-US-FL-JA", + "locationOptions": []}, {"name": "Lakeland", "value": "NOAM-US-FL-LA", "locationOptions": + []}, {"name": "Miami", "value": "NOAM-US-FL-MI", "locationOptions": []}, {"name": + "Orlando", "value": "NOAM-US-FL-OR", "locationOptions": []}, {"name": "Port + St Lucie", "value": "NOAM-US-FL-PS", "locationOptions": []}, {"name": "Sarasota", + "value": "NOAM-US-FL-SA", "locationOptions": []}, {"name": "Tallahassee", "value": + "NOAM-US-FL-TA", "locationOptions": []}, {"name": "West Palm Beach", "value": + "NOAM-US-FL-WP", "locationOptions": []}]}]}, {"name": "GA", "value": "GA", "locationOptions": + [{"labelId": "city", "labelName": "City", "options": [{"name": "Albany", "value": + "NOAM-US-GA-AL", "locationOptions": []}, {"name": "Atlanta", "value": "NOAM-US-GA-AT", + "locationOptions": []}, {"name": "Augusta", "value": "NOAM-US-GA-AU", "locationOptions": + []}, {"name": "Macon", "value": "NOAM-US-GA-MA", "locationOptions": []}, {"name": + "Savannah", "value": "NOAM-US-GA-SA", "locationOptions": []}]}]}, {"name": "HI", + "value": "HI", "locationOptions": [{"labelId": "city", "labelName": "City", + "options": [{"name": "Honolulu", "value": "NOAM-US-HI-HO", "locationOptions": + []}]}]}, {"name": "IA", "value": "IA", "locationOptions": [{"labelId": "city", + "labelName": "City", "options": [{"name": "Cedar Rapids", "value": "NOAM-US-IA-CR", + "locationOptions": []}, {"name": "Davenport", "value": "NOAM-US-IA-DA", "locationOptions": + []}, {"name": "Mason City", "value": "NOAM-US-IA-MC", "locationOptions": []}]}]}, + {"name": "ID", "value": "ID", "locationOptions": [{"labelId": "city", "labelName": + "City", "options": [{"name": "Boise", "value": "NOAM-US-ID-BO", "locationOptions": + []}]}]}, {"name": "IL", "value": "IL", "locationOptions": [{"labelId": "city", + "labelName": "City", "options": [{"name": "Alton", "value": "NOAM-US-IL-AL", + "locationOptions": []}, {"name": "Aurora", "value": "NOAM-US-IL-AU", "locationOptions": + []}, {"name": "Big Rock", "value": "NOAM-US-IL-BK", "locationOptions": []}, + {"name": "Champaign", "value": "NOAM-US-IL-CA", "locationOptions": []}, {"name": + "Chicago", "value": "NOAM-US-IL-CH", "locationOptions": []}, {"name": "Cicero", + "value": "NOAM-US-IL-CI", "locationOptions": []}, {"name": "Rock Island", "value": + "NOAM-US-IL-RI", "locationOptions": []}, {"name": "Waukegan", "value": "NOAM-US-IL-WK", + "locationOptions": []}]}]}, {"name": "IN", "value": "IN", "locationOptions": + [{"labelId": "city", "labelName": "City", "options": [{"name": "Evansville", + "value": "NOAM-US-IN-EV", "locationOptions": []}, {"name": "Fort Wayne", "value": + "NOAM-US-IN-FW", "locationOptions": []}, {"name": "Gary", "value": "NOAM-US-IN-GA", + "locationOptions": []}, {"name": "Indianapolis", "value": "NOAM-US-IN-IN", "locationOptions": + []}, {"name": "South Bend", "value": "NOAM-US-IN-SB", "locationOptions": []}]}]}, + {"name": "KS", "value": "KS", "locationOptions": [{"labelId": "city", "labelName": + "City", "options": [{"name": "Dodge City", "value": "NOAM-US-KS-DC", "locationOptions": + []}, {"name": "Kansas City", "value": "NOAM-US-KS-KS", "locationOptions": []}, + {"name": "Topeka", "value": "NOAM-US-KS-TO", "locationOptions": []}, {"name": + "Wichita", "value": "NOAM-US-KS-WI", "locationOptions": []}]}]}, {"name": "KY", + "value": "KY", "locationOptions": [{"labelId": "city", "labelName": "City", + "options": [{"name": "Ashland", "value": "NOAM-US-KY-AS", "locationOptions": + []}, {"name": "Lexington", "value": "NOAM-US-KY-LE", "locationOptions": []}, + {"name": "Louisville", "value": "NOAM-US-KY-LO", "locationOptions": []}]}]}, + {"name": "LA", "value": "LA", "locationOptions": [{"labelId": "city", "labelName": + "City", "options": [{"name": "Baton Rouge", "value": "NOAM-US-LA-BR", "locationOptions": + []}, {"name": "Lafayette", "value": "NOAM-US-LA-LA", "locationOptions": []}, + {"name": "New Orleans", "value": "NOAM-US-LA-NO", "locationOptions": []}, {"name": + "Shreveport", "value": "NOAM-US-LA-SH", "locationOptions": []}]}]}, {"name": + "MA", "value": "MA", "locationOptions": [{"labelId": "city", "labelName": "City", + "options": [{"name": "Chicopee", "value": "NOAM-US-MA-CH", "locationOptions": + []}]}]}, {"name": "MD", "value": "MD", "locationOptions": [{"labelId": "city", + "labelName": "City", "options": [{"name": "Bethesda", "value": "NOAM-US-MD-BE", + "locationOptions": []}]}]}, {"name": "ME", "value": "ME", "locationOptions": + [{"labelId": "city", "labelName": "City", "options": [{"name": "Portland", "value": + "NOAM-US-ME-PO", "locationOptions": []}]}]}, {"name": "MI", "value": "MI", "locationOptions": + [{"labelId": "city", "labelName": "City", "options": [{"name": "Detroit", "value": + "NOAM-US-MI-DE", "locationOptions": []}, {"name": "Flint", "value": "NOAM-US-MI-FL", + "locationOptions": []}, {"name": "Grand Rapids", "value": "NOAM-US-MI-GP", "locationOptions": + []}, {"name": "Grant", "value": "NOAM-US-MI-GR", "locationOptions": []}, {"name": + "Lansing", "value": "NOAM-US-MI-LA", "locationOptions": []}, {"name": "Saginaw", + "value": "NOAM-US-MI-SA", "locationOptions": []}, {"name": "Sault Ste Marie", + "value": "NOAM-US-MI-SS", "locationOptions": []}, {"name": "Troy", "value": + "NOAM-US-MI-TR", "locationOptions": []}]}]}, {"name": "MN", "value": "MN", "locationOptions": + [{"labelId": "city", "labelName": "City", "options": [{"name": "Alexandria", + "value": "NOAM-US-MN-AL", "locationOptions": []}, {"name": "Duluth", "value": + "NOAM-US-MN-DU", "locationOptions": []}, {"name": "Minneapolis", "value": "NOAM-US-MN-MI", + "locationOptions": []}, {"name": "St. Paul", "value": "NOAM-US-MN-SP", "locationOptions": + []}]}]}, {"name": "MO", "value": "MO", "locationOptions": [{"labelId": "city", + "labelName": "City", "options": [{"name": "Columbia", "value": "NOAM-US-MO-CO", + "locationOptions": []}, {"name": "Kansas City", "value": "NOAM-US-MO-KS", "locationOptions": + []}, {"name": "Marshall", "value": "NOAM-US-MO-MA", "locationOptions": []}, + {"name": "Springfield", "value": "NOAM-US-MO-SP", "locationOptions": []}, {"name": + "St. Charles", "value": "NOAM-US-MO-SC", "locationOptions": []}, {"name": "St. + Louis", "value": "NOAM-US-MO-SL", "locationOptions": []}]}]}, {"name": "MS", + "value": "MS", "locationOptions": [{"labelId": "city", "labelName": "City", + "options": [{"name": "Biloxi", "value": "NOAM-US-MS-BI", "locationOptions": + []}, {"name": "Jackson", "value": "NOAM-US-MS-JA", "locationOptions": []}, {"name": + "Starkville", "value": "NOAM-US-MS-ST", "locationOptions": []}]}]}, {"name": + "MT", "value": "MT", "locationOptions": [{"labelId": "city", "labelName": "City", + "options": [{"name": "Billings", "value": "NOAM-US-MT-BI", "locationOptions": + []}]}]}, {"name": "NC", "value": "NC", "locationOptions": [{"labelId": "city", + "labelName": "City", "options": [{"name": "Charlotte", "value": "NOAM-US-NC-CH", + "locationOptions": []}, {"name": "Fayetteville", "value": "NOAM-US-NC-FA", "locationOptions": + []}, {"name": "Greensboro", "value": "NOAM-US-NC-GR", "locationOptions": []}, + {"name": "Raleigh", "value": "NOAM-US-NC-RA", "locationOptions": []}]}]}, {"name": + "NE", "value": "NE", "locationOptions": [{"labelId": "city", "labelName": "City", + "options": [{"name": "Kearney", "value": "NOAM-US-NE-KE", "locationOptions": + []}, {"name": "Omaha", "value": "NOAM-US-NE-OM", "locationOptions": []}]}]}, + {"name": "NJ", "value": "NJ", "locationOptions": [{"labelId": "city", "labelName": + "City", "options": [{"name": "Atlantic City", "value": "NOAM-US-NJ-AC", "locationOptions": + []}, {"name": "Camden", "value": "NOAM-US-NJ-CA", "locationOptions": []}, {"name": + "Newark", "value": "NOAM-US-NJ-NE", "locationOptions": []}]}]}, {"name": "NM", + "value": "NM", "locationOptions": [{"labelId": "city", "labelName": "City", + "options": [{"name": "Las Cruces", "value": "NOAM-US-NM-LC", "locationOptions": + []}]}]}, {"name": "NV", "value": "NV", "locationOptions": [{"labelId": "city", + "labelName": "City", "options": [{"name": "Las Vegas", "value": "NOAM-US-NV-LV", + "locationOptions": []}, {"name": "Reno", "value": "NOAM-US-NV-RE", "locationOptions": + []}]}]}, {"name": "NY", "value": "NY", "locationOptions": [{"labelId": "city", + "labelName": "City", "options": [{"name": "Albany", "value": "NOAM-US-NY-AL", + "locationOptions": []}, {"name": "Brentwood", "value": "NOAM-US-NY-BR", "locationOptions": + []}, {"name": "Elmira", "value": "NOAM-US-NY-EL", "locationOptions": []}, {"name": + "Hempstead", "value": "NOAM-US-NY-HE", "locationOptions": []}, {"name": "Kingston", + "value": "NOAM-US-NY-KI", "locationOptions": []}, {"name": "New York City", + "value": "NOAM-US-NY-NY", "locationOptions": []}, {"name": "Niagara Falls", + "value": "NOAM-US-NY-NF", "locationOptions": []}, {"name": "Rochester", "value": + "NOAM-US-NY-RO", "locationOptions": []}, {"name": "Syracuse", "value": "NOAM-US-NY-SY", + "locationOptions": []}, {"name": "Yonkers", "value": "NOAM-US-NY-YO", "locationOptions": + []}]}]}, {"name": "OH", "value": "OH", "locationOptions": [{"labelId": "city", + "labelName": "City", "options": [{"name": "Akron", "value": "NOAM-US-OH-AK", + "locationOptions": []}, {"name": "Cincinnati", "value": "NOAM-US-OH-CI", "locationOptions": + []}, {"name": "Columbus", "value": "NOAM-US-OH-CO", "locationOptions": []}, + {"name": "Dayton", "value": "NOAM-US-OH-DA", "locationOptions": []}, {"name": + "Toledo", "value": "NOAM-US-OH-TO", "locationOptions": []}]}]}, {"name": "OK", + "value": "OK", "locationOptions": [{"labelId": "city", "labelName": "City", + "options": [{"name": "Lawton", "value": "NOAM-US-OK-LA", "locationOptions": + []}, {"name": "Oklahoma City", "value": "NOAM-US-OK-OC", "locationOptions": + []}, {"name": "Tulsa", "value": "NOAM-US-OK-TU", "locationOptions": []}]}]}, + {"name": "PA", "value": "PA", "locationOptions": [{"labelId": "city", "labelName": + "City", "options": [{"name": "Erie", "value": "NOAM-US-PA-ER", "locationOptions": + []}, {"name": "Lancaster", "value": "NOAM-US-PA-LA", "locationOptions": []}, + {"name": "New Castle", "value": "NOAM-US-PA-NC", "locationOptions": []}, {"name": + "Philadelphia", "value": "NOAM-US-PA-PI", "locationOptions": []}, {"name": "Pittsburgh", + "value": "NOAM-US-PA-PT", "locationOptions": []}, {"name": "Scranton", "value": + "NOAM-US-PA-SC", "locationOptions": []}]}]}, {"name": "RI", "value": "RI", "locationOptions": + [{"labelId": "city", "labelName": "City", "options": [{"name": "Providence", + "value": "NOAM-US-RI-PR", "locationOptions": []}]}]}, {"name": "SC", "value": + "SC", "locationOptions": [{"labelId": "city", "labelName": "City", "options": + [{"name": "Charleston", "value": "NOAM-US-SC-CH", "locationOptions": []}, {"name": + "Columbia", "value": "NOAM-US-SC-CO", "locationOptions": []}, {"name": "Greenville", + "value": "NOAM-US-SC-GR", "locationOptions": []}]}]}, {"name": "SD", "value": + "SD", "locationOptions": [{"labelId": "city", "labelName": "City", "options": + [{"name": "Sioux Falls", "value": "NOAM-US-SD-SF", "locationOptions": []}]}]}, + {"name": "TN", "value": "TN", "locationOptions": [{"labelId": "city", "labelName": + "City", "options": [{"name": "Chattanooga", "value": "NOAM-US-TN-CH", "locationOptions": + []}, {"name": "Clarksville", "value": "NOAM-US-TN-CL", "locationOptions": []}, + {"name": "Jackson", "value": "NOAM-US-TN-JA", "locationOptions": []}, {"name": + "Knoxville", "value": "NOAM-US-TN-KN", "locationOptions": []}, {"name": "Memphis", + "value": "NOAM-US-TN-ME", "locationOptions": []}, {"name": "Nashville", "value": + "NOAM-US-TN-NA", "locationOptions": []}]}]}, {"name": "TX", "value": "TX", "locationOptions": + [{"labelId": "city", "labelName": "City", "options": [{"name": "Austin", "value": + "NOAM-US-TX-AU", "locationOptions": []}, {"name": "Corpus Christi", "value": + "NOAM-US-TX-CC", "locationOptions": []}, {"name": "Denton", "value": "NOAM-US-TX-DE", + "locationOptions": []}, {"name": "El Paso", "value": "NOAM-US-TX-EP", "locationOptions": + []}, {"name": "Fort Worth", "value": "NOAM-US-TX-FW", "locationOptions": []}, + {"name": "Galveston", "value": "NOAM-US-TX-GA", "locationOptions": []}, {"name": + "Houston", "value": "NOAM-US-TX-HO", "locationOptions": []}, {"name": "Lubbock", + "value": "NOAM-US-TX-LU", "locationOptions": []}, {"name": "Odessa", "value": + "NOAM-US-TX-OD", "locationOptions": []}, {"name": "Tyler", "value": "NOAM-US-TX-TY", + "locationOptions": []}]}]}, {"name": "UT", "value": "UT", "locationOptions": + [{"labelId": "city", "labelName": "City", "options": [{"name": "Salt Lake City", + "value": "NOAM-US-UT-SL", "locationOptions": []}, {"name": "St. George", "value": + "NOAM-US-UT-SG", "locationOptions": []}]}]}, {"name": "VA", "value": "VA", "locationOptions": + [{"labelId": "city", "labelName": "City", "options": [{"name": "Lynchburg", + "value": "NOAM-US-VA-LY", "locationOptions": []}, {"name": "Richmond", "value": + "NOAM-US-VA-RI", "locationOptions": []}, {"name": "Virginia Beach", "value": + "NOAM-US-VA-VB", "locationOptions": []}]}]}, {"name": "VT", "value": "VT", "locationOptions": + [{"labelId": "city", "labelName": "City", "options": [{"name": "Bennington", + "value": "NOAM-US-VT-BE", "locationOptions": []}, {"name": "Brattleboro", "value": + "NOAM-US-VT-BR", "locationOptions": []}, {"name": "Burlington", "value": "NOAM-US-VT-BU", + "locationOptions": []}, {"name": "Middlebury", "value": "NOAM-US-VT-MB", "locationOptions": + []}, {"name": "Montpelier", "value": "NOAM-US-VT-MP", "locationOptions": []}, + {"name": "Newport", "value": "NOAM-US-VT-NE", "locationOptions": []}]}]}, {"name": + "WI", "value": "WI", "locationOptions": [{"labelId": "city", "labelName": "City", + "options": [{"name": "Green Bay", "value": "NOAM-US-WI-GB", "locationOptions": + []}, {"name": "Kenosha", "value": "NOAM-US-WI-KE", "locationOptions": []}, {"name": + "Madison", "value": "NOAM-US-WI-MA", "locationOptions": []}, {"name": "Milwaukee", + "value": "NOAM-US-WI-MI", "locationOptions": []}]}]}, {"name": "WV", "value": + "WV", "locationOptions": [{"labelId": "city", "labelName": "City", "options": + [{"name": "Charleston", "value": "NOAM-US-WV-CH", "locationOptions": []}]}]}, + {"name": "WY", "value": "WY", "locationOptions": [{"labelId": "city", "labelName": + "City", "options": [{"name": "Laramie", "value": "NOAM-US-WY-LA", "locationOptions": + []}]}]}]}}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 28 Sep 2020 23:36:41 GMT + ms-cv: 8nUq6GVatEacy/p8kiqRCw.0 + transfer-encoding: chunked + x-processing-time: 686ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/administration/phonenumbers/countries/US/phoneplangroups/sanitized/phoneplans/sanitized/locationoptions?locale=en-US&api-version=2020-07-20-preview1 +version: 1 diff --git a/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client_async.test_get_release_by_id.yaml b/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client_async.test_get_release_by_id.yaml new file mode 100644 index 000000000000..8c436e502d75 --- /dev/null +++ b/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client_async.test_get_release_by_id.yaml @@ -0,0 +1,29 @@ +interactions: +- request: + body: '' + headers: + Accept: + - application/json + Date: + - Mon, 28 Sep 2020 23:36:42 GMT + User-Agent: + - azsdk-python-communication-administration/1.0.0b1 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/administration/phonenumbers/releases/release_id?api-version=2020-07-20-preview1 + response: + body: '{"releaseId": "sanitized", "createdAt": "2020-09-28T20:09:36.2701214+00:00", + "status": "Failed", "errorMessage": "All numbers in Failed state after BVD call", + "phoneNumberReleaseStatusDetails": "sanitized"}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 28 Sep 2020 23:36:42 GMT + ms-cv: yVEMC2mXsEyHauZmq0ZFPA.0 + transfer-encoding: chunked + x-processing-time: 459ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/administration/phonenumbers/releases/sanitized?api-version=2020-07-20-preview1 +version: 1 diff --git a/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client_async.test_get_search_by_id.yaml b/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client_async.test_get_search_by_id.yaml new file mode 100644 index 000000000000..2ca06363cb93 --- /dev/null +++ b/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client_async.test_get_search_by_id.yaml @@ -0,0 +1,31 @@ +interactions: +- request: + body: '' + headers: + Accept: + - application/json + Date: + - Mon, 28 Sep 2020 23:36:43 GMT + User-Agent: + - azsdk-python-communication-administration/1.0.0b1 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/administration/phonenumbers/searches/search_id?api-version=2020-07-20-preview1 + response: + body: '{"searchId": "sanitized", "displayName": "mysearch20200928", "createdAt": + "2020-09-28T23:34:32.3360015+00:00", "description": "mydescription", "phonePlanIds": + "sanitized", "areaCode": "area_code_for_search", "quantity": 1, "locationOptions": + [], "status": "Reserved", "phoneNumbers": "sanitized", "reservationExpiryDate": + "2020-09-28T23:50:49.3839544+00:00"}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 28 Sep 2020 23:36:43 GMT + ms-cv: P1zGoqpgT06fkeq8C6+pcw.0 + transfer-encoding: chunked + x-processing-time: 742ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/administration/phonenumbers/searches/sanitized?api-version=2020-07-20-preview1 +version: 1 diff --git a/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client_async.test_list_all_phone_numbers.yaml b/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client_async.test_list_all_phone_numbers.yaml new file mode 100644 index 000000000000..d7800f27b062 --- /dev/null +++ b/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client_async.test_list_all_phone_numbers.yaml @@ -0,0 +1,27 @@ +interactions: +- request: + body: '' + headers: + Accept: + - application/json + Date: + - Mon, 28 Sep 2020 23:36:44 GMT + User-Agent: + - azsdk-python-communication-administration/1.0.0b1 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/administration/phonenumbers/phonenumbers?locale=en-US&skip=0&take=100&api-version=2020-07-20-preview1 + response: + body: '{"phoneNumbers": "sanitized", "nextLink": null}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 28 Sep 2020 23:36:44 GMT + ms-cv: EH2E1Zka+EGFjbPr6TUNYA.0 + transfer-encoding: chunked + x-processing-time: 595ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/administration/phonenumbers/phonenumbers?locale=en-US&skip=0&take=100&api-version=2020-07-20-preview1 +version: 1 diff --git a/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client_async.test_list_all_releases.yaml b/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client_async.test_list_all_releases.yaml new file mode 100644 index 000000000000..aa78b029dece --- /dev/null +++ b/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client_async.test_list_all_releases.yaml @@ -0,0 +1,27 @@ +interactions: +- request: + body: '' + headers: + Accept: + - application/json + Date: + - Mon, 28 Sep 2020 23:36:44 GMT + User-Agent: + - azsdk-python-communication-administration/1.0.0b1 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/administration/phonenumbers/releases?skip=0&take=100&api-version=2020-07-20-preview1 + response: + body: '{"entities": "sanitized", "nextLink": null}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 28 Sep 2020 23:36:45 GMT + ms-cv: II5poJgvcUGGyAE6o/9qOA.0 + transfer-encoding: chunked + x-processing-time: 706ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/administration/phonenumbers/releases?skip=0&take=100&api-version=2020-07-20-preview1 +version: 1 diff --git a/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client_async.test_list_all_supported_countries.yaml b/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client_async.test_list_all_supported_countries.yaml new file mode 100644 index 000000000000..c97cec973db3 --- /dev/null +++ b/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client_async.test_list_all_supported_countries.yaml @@ -0,0 +1,29 @@ +interactions: +- request: + body: '' + headers: + Accept: + - application/json + Date: + - Mon, 28 Sep 2020 23:36:45 GMT + User-Agent: + - azsdk-python-communication-administration/1.0.0b1 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/administration/phonenumbers/countries?locale=en-US&skip=0&take=100&api-version=2020-07-20-preview1 + response: + body: '{"countries": [{"localizedName": "Australia", "countryCode": "AU"}, {"localizedName": + "Japan", "countryCode": "JP"}, {"localizedName": "United States", "countryCode": + "US"}], "nextLink": null}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 28 Sep 2020 23:36:46 GMT + ms-cv: CVi9HTPzcEeEqH7obRf9tA.0 + transfer-encoding: chunked + x-processing-time: 901ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/administration/phonenumbers/countries?locale=en-US&skip=0&take=100&api-version=2020-07-20-preview1 +version: 1 diff --git a/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client_async.test_list_phone_plan_groups.yaml b/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client_async.test_list_phone_plan_groups.yaml new file mode 100644 index 000000000000..1138d9616585 --- /dev/null +++ b/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client_async.test_list_phone_plan_groups.yaml @@ -0,0 +1,27 @@ +interactions: +- request: + body: '' + headers: + Accept: + - application/json + Date: + - Mon, 28 Sep 2020 23:36:47 GMT + User-Agent: + - azsdk-python-communication-administration/1.0.0b1 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/administration/phonenumbers/countries/US/phoneplangroups?locale=en-US&includeRateInformation=false&skip=0&take=100&api-version=2020-07-20-preview1 + response: + body: '{"phonePlanGroups": "sanitized", "nextLink": null}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 28 Sep 2020 23:36:47 GMT + ms-cv: 2JfFR8NjR06p3+cz6Rcc4w.0 + transfer-encoding: chunked + x-processing-time: 519ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/administration/phonenumbers/countries/US/phoneplangroups?locale=en-US&includeRateInformation=false&skip=0&take=100&api-version=2020-07-20-preview1 +version: 1 diff --git a/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client_async.test_list_phone_plans.yaml b/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client_async.test_list_phone_plans.yaml new file mode 100644 index 000000000000..23f015234396 --- /dev/null +++ b/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client_async.test_list_phone_plans.yaml @@ -0,0 +1,27 @@ +interactions: +- request: + body: '' + headers: + Accept: + - application/json + Date: + - Mon, 28 Sep 2020 23:36:48 GMT + User-Agent: + - azsdk-python-communication-administration/1.0.0b1 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/administration/phonenumbers/countries/US/phoneplangroups/phone_plan_group_id/phoneplans?locale=en-US&skip=0&take=100&api-version=2020-07-20-preview1 + response: + body: '{"phonePlans": "sanitized", "nextLink": null}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 28 Sep 2020 23:36:48 GMT + ms-cv: qCvIQBx7mEev7YmmcSTSPQ.0 + transfer-encoding: chunked + x-processing-time: 583ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/administration/phonenumbers/countries/US/phoneplangroups/sanitized/phoneplans?locale=en-US&skip=0&take=100&api-version=2020-07-20-preview1 +version: 1 diff --git a/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client_async.test_purchase_search.yaml b/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client_async.test_purchase_search.yaml new file mode 100644 index 000000000000..57b89ebc1547 --- /dev/null +++ b/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client_async.test_purchase_search.yaml @@ -0,0 +1,25 @@ +interactions: +- request: + body: '' + headers: + Date: + - Mon, 28 Sep 2020 23:23:44 GMT + User-Agent: + - azsdk-python-communication-administration/1.0.0b1 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/administration/phonenumbers/searches/search_id_to_purchase/purchase?api-version=2020-07-20-preview1 + response: + body: + string: '' + headers: + content-length: '0' + date: Mon, 28 Sep 2020 23:23:45 GMT + ms-cv: vznK/aE7iECofyT07WWRFQ.0 + x-processing-time: 1402ms + status: + code: 202 + message: Accepted + url: https://sanitized.communication.azure.com/administration/phonenumbers/searches/sanitized/purchase?api-version=2020-07-20-preview1 +version: 1 diff --git a/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client_async.test_update_capabilities.yaml b/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client_async.test_update_capabilities.yaml new file mode 100644 index 000000000000..d851620517bd --- /dev/null +++ b/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client_async.test_update_capabilities.yaml @@ -0,0 +1,32 @@ +interactions: +- request: + body: 'b''{"phoneNumberCapabilitiesUpdate": {"+1area_code_for_search4866306": + {"add": []}}}''' + headers: + Accept: + - application/json + Content-Length: + - '64' + Content-Type: + - application/json + Date: + - Mon, 28 Sep 2020 23:36:48 GMT + User-Agent: + - azsdk-python-communication-administration/1.0.0b1 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/administration/phonenumbers/capabilities?api-version=2020-07-20-preview1 + response: + body: '{"capabilitiesUpdateId": "sanitized"}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 28 Sep 2020 23:36:49 GMT + ms-cv: 6rr7snA3ek6iPySfBZZvHw.0 + transfer-encoding: chunked + x-processing-time: 1177ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/administration/phonenumbers/capabilities?api-version=2020-07-20-preview1 +version: 1 diff --git a/sdk/communication/azure-communication-administration/tests/test_phone_number_administration_client.py b/sdk/communication/azure-communication-administration/tests/test_phone_number_administration_client.py new file mode 100644 index 000000000000..90b6b50f35ec --- /dev/null +++ b/sdk/communication/azure-communication-administration/tests/test_phone_number_administration_client.py @@ -0,0 +1,249 @@ +# coding: utf-8 +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- +import pytest +import os +from azure.communication.administration import ( + PhoneNumberAdministrationClient, + PstnConfiguration, + NumberUpdateCapabilities, + CreateSearchOptions +) +from phone_number_helper import PhoneNumberUriReplacer +from _shared.testcase import ( + CommunicationTestCase, + BodyReplacerProcessor +) + +class PhoneNumberAdministrationClientTest(CommunicationTestCase): + + 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_TNM_COUNTRY_CODE') + self.locale = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_LOCALE') + self.phone_plan_group_id = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_PHONE_PLAN_GROUP_ID') + self.phone_plan_id = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_PHONE_PLAN_ID') + self.phone_plan_id_area_codes = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_PHONE_PLAN_ID_AREA_CODES') + self.area_code_for_search = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_AREA_CODE_FOR_SEARCH') + self.search_id = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_SEARCH_ID') + self.search_id_to_purchase = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_SEARCH_ID_TO_PURCHASE') + self.search_id_to_cancel = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_SEARCH_ID_TO_CANCEL') + self.phonenumber_to_configure = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_PHONENUMBER_TO_CONFIGURE') + self.phonenumber_to_get_config = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_PHONENUMBER_TO_GET_CONFIG') + self.phonenumber_to_unconfigure = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_PHONENUMBER_TO_UNCONFIGURE') + self.phonenumber_for_capabilities = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_PHONENUMBER_FOR_CAPABILITIES') + self.capabilities_id = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_CAPABILITIES_ID') + self.release_id = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_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_search, + "area_code_for_search" + ) + self.scrubber.register_name_pair( + self.search_id, + "search_id" + ) + self.scrubber.register_name_pair( + self.search_id_to_purchase, + "search_id_to_purchase" + ) + self.scrubber.register_name_pair( + self.search_id_to_cancel, + "search_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.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_search = "area_code_for_search" + self.search_id = "search_id" + self.search_id_to_purchase = "search_id_to_purchase" + self.search_id_to_cancel = "search_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.capabilities_id = "capabilities_id" + self.release_id = "release_id" + + @pytest.mark.live_test_only + def test_list_all_phone_numbers(self): + pages = self._phone_number_administration_client.list_all_phone_numbers() + assert pages.next() + + @pytest.mark.live_test_only + def test_get_all_area_codes(self): + area_codes = self._phone_number_administration_client.get_all_area_codes( + location_type="NotRequired", + country_code=self.country_code, + phone_plan_id=self.phone_plan_id_area_codes + ) + assert area_codes.primary_area_codes + + @pytest.mark.live_test_only + def test_get_capabilities_update(self): + capability_response = self._phone_number_administration_client.get_capabilities_update( + capabilities_update_id=self.capabilities_id + ) + assert capability_response.capabilities_update_id + + @pytest.mark.live_test_only + def test_update_capabilities(self): + update = NumberUpdateCapabilities(add=iter(["InboundCalling"])) + + phone_number_capabilities_update = { + self.phonenumber_for_capabilities: update + } + + capability_response = self._phone_number_administration_client.update_capabilities( + phone_number_capabilities_update=phone_number_capabilities_update + ) + assert capability_response.capabilities_update_id + + @pytest.mark.live_test_only + def test_list_all_supported_countries(self): + countries = self._phone_number_administration_client.list_all_supported_countries() + assert countries.next().localized_name + + @pytest.mark.live_test_only + def test_get_number_configuration(self): + phone_number_response = self._phone_number_administration_client.get_number_configuration( + phone_number=self.phonenumber_to_unconfigure + ) + assert phone_number_response.pstn_configuration + + @pytest.mark.live_test_only + def test_configure_number(self): + pstnConfig = PstnConfiguration( + callback_url="https://callbackurl", + application_id="ApplicationId", + azure_pstn_target_id="AzurePstnTargetId" + ) + configure_number_response = self._phone_number_administration_client.configure_number( + pstn_configuration=pstnConfig, + phone_number=self.phonenumber_to_unconfigure + ) + assert not configure_number_response + + @pytest.mark.live_test_only + def test_list_phone_plan_groups(self): + phone_plan_group_response = self._phone_number_administration_client.list_phone_plan_groups( + country_code=self.country_code + ) + assert phone_plan_group_response.next().phone_plan_group_id + + @pytest.mark.live_test_only + def test_list_phone_plans(self): + phone_plan_response = self._phone_number_administration_client.list_phone_plans( + country_code=self.country_code, + phone_plan_group_id=self.phone_plan_group_id + ) + assert phone_plan_response.next().phone_plan_id + + @pytest.mark.live_test_only + def test_get_phone_plan_location_options(self): + location_options_response = self._phone_number_administration_client.get_phone_plan_location_options( + country_code=self.country_code, + phone_plan_group_id=self.phone_plan_group_id, + phone_plan_id=self.phone_plan_id + ) + assert location_options_response.location_options.label_id + + @pytest.mark.live_test_only + def test_get_release_by_id(self): + phone_number_release_response = self._phone_number_administration_client.get_release_by_id( + release_id=self.release_id + ) + assert phone_number_release_response.release_id + + @pytest.mark.live_test_only + def test_list_all_releases(self): + releases_response = self._phone_number_administration_client.list_all_releases() + assert releases_response.next().id + + @pytest.mark.live_test_only + def test_get_search_by_id(self): + phone_number_search_response = self._phone_number_administration_client.get_search_by_id( + search_id=self.search_id + ) + assert phone_number_search_response.search_id + + @pytest.mark.live_test_only + def test_create_search(self): + searchOptions = CreateSearchOptions( + area_code=self.area_code_for_search, + description="testsearch20200014", + display_name="testsearch20200014", + phone_plan_ids=[self.phone_plan_id], + quantity=1 + ) + search_response = self._phone_number_administration_client.create_search( + body=searchOptions + ) + assert search_response.search_id + + @pytest.mark.live_test_only + def test_cancel_search(self): + cancel_search_response = self._phone_number_administration_client.cancel_search( + search_id=self.search_id_to_cancel + ) + assert not cancel_search_response + + @pytest.mark.live_test_only + def test_purchase_search(self): + purchase_search_response = self._phone_number_administration_client.purchase_search( + search_id=self.search_id_to_purchase + ) + assert not purchase_search_response diff --git a/sdk/communication/azure-communication-administration/tests/test_phone_number_administration_client_async.py b/sdk/communication/azure-communication-administration/tests/test_phone_number_administration_client_async.py new file mode 100644 index 000000000000..178515f52e04 --- /dev/null +++ b/sdk/communication/azure-communication-administration/tests/test_phone_number_administration_client_async.py @@ -0,0 +1,305 @@ +# coding: utf-8 +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- +import pytest +from azure.communication.administration.aio import PhoneNumberAdministrationClient +from azure.communication.administration import ( + PstnConfiguration, + NumberUpdateCapabilities, + CreateSearchOptions +) +from phone_number_helper import PhoneNumberUriReplacer +from _shared.asynctestcase import ( + AsyncCommunicationTestCase +) +from _shared.testcase import BodyReplacerProcessor, ResponseReplacerProcessor +import os + +class PhoneNumberAdministrationClientTestAsync(AsyncCommunicationTestCase): + + def setUp(self): + super(PhoneNumberAdministrationClientTestAsync, self).setUp() + self.recording_processors.extend([ + BodyReplacerProcessor( + keys=["id", "token", "capabilitiesUpdateId", "phoneNumber", "phonePlanIds", + "phoneNumberCapabilitiesUpdates", "releaseId", + "phoneNumberReleaseStatusDetails", "searchId", "phoneNumbers", + "entities", "phonePlanGroups", "phonePlans", "phoneNumberCapabilitiesUpdate"] + ), + PhoneNumberUriReplacer(), + ResponseReplacerProcessor(keys=[self._resource_name])]) + self._phone_number_administration_client = PhoneNumberAdministrationClient.from_connection_string( + self.connection_str) + if self.is_live: + self.country_code = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_COUNTRY_CODE') + self.locale = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_LOCALE') + self.phone_plan_group_id = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_PHONE_PLAN_GROUP_ID') + self.phone_plan_id = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_PHONE_PLAN_ID') + self.phone_plan_id_area_codes = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_PHONE_PLAN_ID_AREA_CODES') + self.area_code_for_search = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_AREA_CODE_FOR_SEARCH') + self.search_id = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_SEARCH_ID') + self.search_id_to_purchase = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_SEARCH_ID_TO_PURCHASE') + self.search_id_to_cancel = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_SEARCH_ID_TO_CANCEL') + self.phonenumber_to_configure = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_PHONENUMBER_TO_CONFIGURE') + self.phonenumber_to_get_config = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_PHONENUMBER_TO_GET_CONFIG') + self.phonenumber_to_unconfigure = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_PHONENUMBER_TO_UNCONFIGURE') + self.phonenumber_for_capabilities = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_PHONENUMBER_FOR_CAPABILITIES') + self.capabilities_id = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_CAPABILITIES_ID') + self.release_id = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_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_search, + "area_code_for_search" + ) + self.scrubber.register_name_pair( + self.search_id, + "search_id" + ) + self.scrubber.register_name_pair( + self.search_id_to_purchase, + "search_id_to_purchase" + ) + self.scrubber.register_name_pair( + self.search_id_to_cancel, + "search_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.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_search = "area_code_for_search" + self.search_id = "search_id" + self.search_id_to_purchase = "search_id_to_purchase" + self.search_id_to_cancel = "search_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.capabilities_id = "capabilities_id" + self.release_id = "release_id" + + @AsyncCommunicationTestCase.await_prepared_test + @pytest.mark.live_test_only + async def test_list_all_phone_numbers(self): + async with self._phone_number_administration_client: + pages = self._phone_number_administration_client.list_all_phone_numbers() + + items = [] + async for item in pages: + items.append(item) + assert len(items) > 0 + + @AsyncCommunicationTestCase.await_prepared_test + @pytest.mark.live_test_only + async def test_get_all_area_codes(self): + async with self._phone_number_administration_client: + area_codes = await self._phone_number_administration_client.get_all_area_codes( + location_type="NotRequired", + country_code=self.country_code, + phone_plan_id=self.phone_plan_id_area_codes + ) + assert area_codes.primary_area_codes + + @AsyncCommunicationTestCase.await_prepared_test + @pytest.mark.live_test_only + async def test_get_capabilities_update(self): + async with self._phone_number_administration_client: + capability_response = await self._phone_number_administration_client.get_capabilities_update( + capabilities_update_id=self.capabilities_id + ) + assert capability_response.capabilities_update_id + + @AsyncCommunicationTestCase.await_prepared_test + @pytest.mark.live_test_only + async def test_update_capabilities(self): + update = NumberUpdateCapabilities(add=iter(["InboundCalling"])) + + phone_number_capabilities_update = { + self.phonenumber_for_capabilities: update + } + + async with self._phone_number_administration_client: + capability_response = await self._phone_number_administration_client.update_capabilities( + phone_number_capabilities_update=phone_number_capabilities_update + ) + assert capability_response.capabilities_update_id + + @AsyncCommunicationTestCase.await_prepared_test + @pytest.mark.live_test_only + async def test_list_all_supported_countries(self): + async with self._phone_number_administration_client: + countries = self._phone_number_administration_client.list_all_supported_countries() + items = [] + async for item in countries: + items.append(item) + self.assertGreater(len(items), 0) + assert items[0].localized_name + + @AsyncCommunicationTestCase.await_prepared_test + @pytest.mark.live_test_only + async def test_get_number_configuration(self): + async with self._phone_number_administration_client: + phone_number_response = await self._phone_number_administration_client.get_number_configuration( + phone_number=self.phonenumber_to_get_config + ) + assert phone_number_response.pstn_configuration + + @AsyncCommunicationTestCase.await_prepared_test + @pytest.mark.live_test_only + async def test_configure_number(self): + pstnConfig = PstnConfiguration( + callback_url="https://callbackurl", + application_id="ApplicationId", + azure_pstn_target_id="AzurePstnTargetId" + ) + async with self._phone_number_administration_client: + configure_number_response = await self._phone_number_administration_client.configure_number( + pstn_configuration=pstnConfig, + phone_number=self.phonenumber_to_configure + ) + assert not configure_number_response + + @AsyncCommunicationTestCase.await_prepared_test + @pytest.mark.live_test_only + async def test_list_phone_plan_groups(self): + async with self._phone_number_administration_client: + phone_plan_group_response = self._phone_number_administration_client.list_phone_plan_groups( + country_code=self.country_code + ) + + items = [] + async for item in phone_plan_group_response: + items.append(item) + assert len(items) > 0 + assert items[0].phone_plan_group_id + + @AsyncCommunicationTestCase.await_prepared_test + @pytest.mark.live_test_only + async def test_list_phone_plans(self): + async with self._phone_number_administration_client: + phone_plan_response = self._phone_number_administration_client.list_phone_plans( + country_code=self.country_code, + phone_plan_group_id=self.phone_plan_group_id + ) + + items = [] + async for item in phone_plan_response: + items.append(item) + assert len(items) > 0 + assert items[0].phone_plan_id + + @AsyncCommunicationTestCase.await_prepared_test + @pytest.mark.live_test_only + async def test_get_phone_plan_location_options(self): + async with self._phone_number_administration_client: + location_options_response = await self._phone_number_administration_client.get_phone_plan_location_options( + country_code=self.country_code, + phone_plan_group_id=self.phone_plan_group_id, + phone_plan_id=self.phone_plan_id + ) + assert location_options_response.location_options.label_id + + @AsyncCommunicationTestCase.await_prepared_test + @pytest.mark.live_test_only + async def test_get_release_by_id(self): + async with self._phone_number_administration_client: + phone_number_release_response = await self._phone_number_administration_client.get_release_by_id( + release_id=self.release_id + ) + assert phone_number_release_response.release_id + + @AsyncCommunicationTestCase.await_prepared_test + @pytest.mark.live_test_only + async def test_list_all_releases(self): + async with self._phone_number_administration_client: + releases_response = self._phone_number_administration_client.list_all_releases() + + items = [] + async for item in releases_response: + items.append(item) + self.assertGreater(len(items), 0) + assert items[0].id + + @AsyncCommunicationTestCase.await_prepared_test + @pytest.mark.live_test_only + async def test_get_search_by_id(self): + async with self._phone_number_administration_client: + phone_number_search_response = await self._phone_number_administration_client.get_search_by_id( + search_id=self.search_id + ) + assert phone_number_search_response.search_id + + @AsyncCommunicationTestCase.await_prepared_test + @pytest.mark.live_test_only + async def test_create_search(self): + searchOptions = CreateSearchOptions( + area_code=self.area_code_for_search, + description="testsearch20200014", + display_name="testsearch20200014", + phone_plan_ids=[self.phone_plan_id], + quantity=1 + ) + async with self._phone_number_administration_client: + search_response = await self._phone_number_administration_client.create_search( + body=searchOptions + ) + assert search_response.search_id + + @AsyncCommunicationTestCase.await_prepared_test + @pytest.mark.live_test_only + async def test_cancel_search(self): + async with self._phone_number_administration_client: + cancel_search_response = await self._phone_number_administration_client.cancel_search( + search_id=self.search_id_to_cancel + ) + assert not cancel_search_response + + @AsyncCommunicationTestCase.await_prepared_test + @pytest.mark.live_test_only + async def test_purchase_search(self): + async with self._phone_number_administration_client: + purchase_search_response = await self._phone_number_administration_client.purchase_search( + search_id=self.search_id_to_purchase + ) + assert not purchase_search_response