Skip to content

Commit

Permalink
Azure Communication Service - Phone Number Administration - Live Test (
Browse files Browse the repository at this point in the history
…#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
ytyeason and Eason Yang authored Sep 30, 2020
1 parent 2702269 commit dc83fae
Show file tree
Hide file tree
Showing 36 changed files with 2,094 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
ReleaseResponse,
UpdateNumberCapabilitiesResponse,
UpdatePhoneNumberCapabilitiesResponse,
CreateSearchOptions
)

from ._shared.models import (
Expand Down Expand Up @@ -66,6 +67,7 @@
'ReleaseResponse',
'UpdateNumberCapabilitiesResponse',
'UpdatePhoneNumberCapabilitiesResponse',
'CreateSearchOptions',

# from _shared
'CommunicationUser',
Expand Down
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
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
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
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
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
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
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
Loading

0 comments on commit dc83fae

Please sign in to comment.