-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Azure Communication Service - Phone Number Administration - Live Test (…
…#14109) * add tnm live tests and recordings * address comments * assert functions returning none * sync srubbed config and playback config Co-authored-by: Eason Yang <easony@microsoft.com>
- Loading branch information
Showing
36 changed files
with
2,094 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
sdk/communication/azure-communication-administration/tests/phone_number_helper.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
36 changes: 36 additions & 0 deletions
36
...stration/tests/recordings/test_phone_number_administration_client.test_cancel_search.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
39 changes: 39 additions & 0 deletions
39
...ation/tests/recordings/test_phone_number_administration_client.test_configure_number.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
41 changes: 41 additions & 0 deletions
41
...stration/tests/recordings/test_phone_number_administration_client.test_create_search.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
39 changes: 39 additions & 0 deletions
39
...ion/tests/recordings/test_phone_number_administration_client.test_get_all_area_codes.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
36 changes: 36 additions & 0 deletions
36
...ests/recordings/test_phone_number_administration_client.test_get_capabilities_update.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
40 changes: 40 additions & 0 deletions
40
...sts/recordings/test_phone_number_administration_client.test_get_number_configuration.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
Oops, something went wrong.