Skip to content

Commit 1470bc7

Browse files
Added phone number exception tests (Azure#18146)
1 parent 5443085 commit 1470bc7

File tree

19 files changed

+513
-128
lines changed

19 files changed

+513
-128
lines changed

sdk/communication/azure-communication-phonenumbers/test/recordings/test_phone_number_administration_client.test_get_purchased_phone_number.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ interactions:
99
Connection:
1010
- keep-alive
1111
Date:
12-
- Wed, 07 Apr 2021 18:26:53 GMT
12+
- Mon, 19 Apr 2021 21:48:46 GMT
1313
User-Agent:
14-
- azsdk-python-communication-phonenumbers/1.0.0b5 Python/3.8.5 (Windows-10-10.0.19041-SP0)
14+
- azsdk-python-communication-phonenumbers/1.0.0b5 Python/3.9.0 (Windows-10-10.0.19041-SP0)
1515
x-ms-return-client-request-id:
1616
- 'true'
1717
method: GET
@@ -28,15 +28,15 @@ interactions:
2828
content-type:
2929
- application/json; charset=utf-8
3030
date:
31-
- Wed, 07 Apr 2021 18:26:53 GMT
31+
- Mon, 19 Apr 2021 21:48:48 GMT
3232
ms-cv:
33-
- Fm7esbS6ykOT9mE5oXl6kg.0
33+
- icnv38Nf2Ee4VYsAtG0drw.0
3434
request-context:
3535
- appId=
3636
transfer-encoding:
3737
- chunked
3838
x-processing-time:
39-
- 1350ms
39+
- 2326ms
4040
status:
4141
code: 200
4242
message: OK

sdk/communication/azure-communication-phonenumbers/test/recordings/test_phone_number_administration_client.test_get_purchased_phone_number_from_managed_identity.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ interactions:
99
Connection:
1010
- keep-alive
1111
User-Agent:
12-
- azsdk-python-communication-phonenumbers/1.0.0b5 Python/3.8.5 (Windows-10-10.0.19041-SP0)
12+
- azsdk-python-communication-phonenumbers/1.0.0b5 Python/3.9.0 (Windows-10-10.0.19041-SP0)
1313
method: GET
1414
uri: https://sanitized.communication.azure.com/phoneNumbers/sanitized?api-version=2021-03-07
1515
response:
@@ -24,15 +24,15 @@ interactions:
2424
content-type:
2525
- application/json; charset=utf-8
2626
date:
27-
- Wed, 07 Apr 2021 18:26:55 GMT
27+
- Mon, 19 Apr 2021 21:48:50 GMT
2828
ms-cv:
29-
- jD98+LYr7kiS4MN9Jd9l4g.0
29+
- Zi4vLw+YjEq33j5+bRQ0/Q.0
3030
request-context:
3131
- appId=
3232
transfer-encoding:
3333
- chunked
3434
x-processing-time:
35-
- 1208ms
35+
- 1730ms
3636
status:
3737
code: 200
3838
message: OK
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
interactions:
2+
- request:
3+
body: null
4+
headers:
5+
Accept:
6+
- application/json
7+
Accept-Encoding:
8+
- gzip, deflate
9+
Connection:
10+
- keep-alive
11+
Date:
12+
- Mon, 19 Apr 2021 21:48:51 GMT
13+
User-Agent:
14+
- azsdk-python-communication-phonenumbers/1.0.0b5 Python/3.9.0 (Windows-10-10.0.19041-SP0)
15+
x-ms-return-client-request-id:
16+
- 'true'
17+
method: GET
18+
uri: https://sanitized.communication.azure.com/phoneNumbers/sanitized?api-version=2021-03-07
19+
response:
20+
body:
21+
string: '{"error": {"code": "PhoneNumberNotFound", "message": "The specified
22+
phone number +14255550123 cannot be found.", "target": "phonenumber"}}'
23+
headers:
24+
api-supported-versions:
25+
- '2021-03-07'
26+
content-type:
27+
- application/json
28+
date:
29+
- Mon, 19 Apr 2021 21:48:51 GMT
30+
ms-cv:
31+
- 5h1NjStvd0SrcZTNKmwgtw.0
32+
request-context:
33+
- appId=
34+
transfer-encoding:
35+
- chunked
36+
x-processing-time:
37+
- 775ms
38+
status:
39+
code: 404
40+
message: Not Found
41+
url: sanitized
42+
version: 1

sdk/communication/azure-communication-phonenumbers/test/recordings/test_phone_number_administration_client.test_list_purchased_phone_numbers.yaml

Lines changed: 38 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,29 +9,37 @@ interactions:
99
Connection:
1010
- keep-alive
1111
Date:
12-
- Wed, 07 Apr 2021 18:26:57 GMT
12+
- Mon, 19 Apr 2021 21:48:52 GMT
1313
User-Agent:
14-
- azsdk-python-communication-phonenumbers/1.0.0b5 Python/3.8.5 (Windows-10-10.0.19041-SP0)
14+
- azsdk-python-communication-phonenumbers/1.0.0b5 Python/3.9.0 (Windows-10-10.0.19041-SP0)
1515
x-ms-return-client-request-id:
1616
- 'true'
1717
method: GET
1818
uri: https://sanitized.communication.azure.com/phoneNumbers?skip=0&top=100&api-version=2021-03-07
1919
response:
2020
body:
2121
string: '{"phoneNumbers": [{"id": "sanitized", "phoneNumber": "sanitized", "countryCode":
22-
"US", "phoneNumberType": "geographic", "capabilities": {"calling": "outbound",
23-
"sms": "none"}, "assignmentType": "application", "purchaseDate": "2021-04-06T23:27:52.858607+00:00",
22+
"US", "phoneNumberType": "geographic", "capabilities": {"calling": "inbound+outbound",
23+
"sms": "none"}, "assignmentType": "application", "purchaseDate": "2021-04-14T00:23:52.1861991+00:00",
2424
"cost": {"amount": 1.0, "currencyCode": "USD", "billingFrequency": "monthly"}},
2525
{"id": "sanitized", "phoneNumber": "sanitized", "countryCode": "US", "phoneNumberType":
2626
"geographic", "capabilities": {"calling": "inbound", "sms": "none"}, "assignmentType":
27+
"application", "purchaseDate": "2021-04-14T21:31:30.9566555+00:00", "cost":
28+
{"amount": 1.0, "currencyCode": "USD", "billingFrequency": "monthly"}}, {"id":
29+
"sanitized", "phoneNumber": "sanitized", "countryCode": "US", "phoneNumberType":
30+
"geographic", "capabilities": {"calling": "outbound", "sms": "none"}, "assignmentType":
31+
"application", "purchaseDate": "2021-04-06T23:27:52.858607+00:00", "cost":
32+
{"amount": 1.0, "currencyCode": "USD", "billingFrequency": "monthly"}}, {"id":
33+
"sanitized", "phoneNumber": "sanitized", "countryCode": "US", "phoneNumberType":
34+
"geographic", "capabilities": {"calling": "inbound", "sms": "none"}, "assignmentType":
2735
"application", "purchaseDate": "2021-04-06T23:48:49.38583+00:00", "cost":
2836
{"amount": 1.0, "currencyCode": "USD", "billingFrequency": "monthly"}}, {"id":
2937
"sanitized", "phoneNumber": "sanitized", "countryCode": "US", "phoneNumberType":
3038
"tollFree", "capabilities": {"calling": "none", "sms": "inbound+outbound"},
3139
"assignmentType": "application", "purchaseDate": "2021-02-10T17:51:13.4876763+00:00",
3240
"cost": {"amount": 2.0, "currencyCode": "USD", "billingFrequency": "monthly"}},
3341
{"id": "sanitized", "phoneNumber": "sanitized", "countryCode": "US", "phoneNumberType":
34-
"tollFree", "capabilities": {"calling": "none", "sms": "inbound"}, "assignmentType":
42+
"tollFree", "capabilities": {"calling": "none", "sms": "outbound"}, "assignmentType":
3543
"application", "purchaseDate": "2021-02-10T17:52:41.818335+00:00", "cost":
3644
{"amount": 2.0, "currencyCode": "USD", "billingFrequency": "monthly"}}, {"id":
3745
"sanitized", "phoneNumber": "sanitized", "countryCode": "US", "phoneNumberType":
@@ -55,11 +63,11 @@ interactions:
5563
"application", "purchaseDate": "2021-03-26T20:48:35.6663829+00:00", "cost":
5664
{"amount": 2.0, "currencyCode": "USD", "billingFrequency": "monthly"}}, {"id":
5765
"sanitized", "phoneNumber": "sanitized", "countryCode": "US", "phoneNumberType":
58-
"tollFree", "capabilities": {"calling": "inbound+outbound", "sms": "inbound+outbound"},
59-
"assignmentType": "application", "purchaseDate": "2021-03-26T22:41:03.6935096+00:00",
60-
"cost": {"amount": 2.0, "currencyCode": "USD", "billingFrequency": "monthly"}},
61-
{"id": "sanitized", "phoneNumber": "sanitized", "countryCode": "US", "phoneNumberType":
62-
"tollFree", "capabilities": {"calling": "inbound", "sms": "inbound+outbound"},
66+
"tollFree", "capabilities": {"calling": "none", "sms": "outbound"}, "assignmentType":
67+
"application", "purchaseDate": "2021-03-26T22:41:03.6935096+00:00", "cost":
68+
{"amount": 2.0, "currencyCode": "USD", "billingFrequency": "monthly"}}, {"id":
69+
"sanitized", "phoneNumber": "sanitized", "countryCode": "US", "phoneNumberType":
70+
"tollFree", "capabilities": {"calling": "inbound+outbound", "sms": "none"},
6371
"assignmentType": "application", "purchaseDate": "2021-03-29T20:13:20.1694649+00:00",
6472
"cost": {"amount": 2.0, "currencyCode": "USD", "billingFrequency": "monthly"}},
6573
{"id": "sanitized", "phoneNumber": "sanitized", "countryCode": "US", "phoneNumberType":
@@ -104,23 +112,39 @@ interactions:
104112
"cost": {"amount": 2.0, "currencyCode": "USD", "billingFrequency": "monthly"}},
105113
{"id": "sanitized", "phoneNumber": "sanitized", "countryCode": "US", "phoneNumberType":
106114
"tollFree", "capabilities": {"calling": "inbound", "sms": "inbound+outbound"},
115+
"assignmentType": "application", "purchaseDate": "2021-04-08T16:18:38.5365335+00:00",
116+
"cost": {"amount": 2.0, "currencyCode": "USD", "billingFrequency": "monthly"}},
117+
{"id": "sanitized", "phoneNumber": "sanitized", "countryCode": "US", "phoneNumberType":
118+
"tollFree", "capabilities": {"calling": "inbound", "sms": "inbound+outbound"},
119+
"assignmentType": "application", "purchaseDate": "2021-04-08T19:48:38.3328121+00:00",
120+
"cost": {"amount": 2.0, "currencyCode": "USD", "billingFrequency": "monthly"}},
121+
{"id": "sanitized", "phoneNumber": "sanitized", "countryCode": "US", "phoneNumberType":
122+
"tollFree", "capabilities": {"calling": "inbound", "sms": "inbound+outbound"},
123+
"assignmentType": "application", "purchaseDate": "2021-04-08T20:56:52.3906615+00:00",
124+
"cost": {"amount": 2.0, "currencyCode": "USD", "billingFrequency": "monthly"}},
125+
{"id": "sanitized", "phoneNumber": "sanitized", "countryCode": "US", "phoneNumberType":
126+
"tollFree", "capabilities": {"calling": "inbound", "sms": "inbound+outbound"},
107127
"assignmentType": "application", "purchaseDate": "2000-01-01T00:00:00+00:00",
108-
"cost": {"amount": 2.0, "currencyCode": "USD", "billingFrequency": "monthly"}}]}'
128+
"cost": {"amount": 2.0, "currencyCode": "USD", "billingFrequency": "monthly"}},
129+
{"id": "sanitized", "phoneNumber": "sanitized", "countryCode": "US", "phoneNumberType":
130+
"geographic", "capabilities": {"calling": "inbound+outbound", "sms": "none"},
131+
"assignmentType": "application", "purchaseDate": "2021-04-14T15:50:33.2361831+00:00",
132+
"cost": {"amount": 1.0, "currencyCode": "USD", "billingFrequency": "monthly"}}]}'
109133
headers:
110134
api-supported-versions:
111135
- '2021-03-07'
112136
content-type:
113137
- application/json; charset=utf-8
114138
date:
115-
- Wed, 07 Apr 2021 18:27:07 GMT
139+
- Mon, 19 Apr 2021 21:49:11 GMT
116140
ms-cv:
117-
- x59p5VhiF0+wRTMCvr6o4A.0
141+
- t1PykxARPUOCUU7QX1bUqQ.0
118142
request-context:
119143
- appId=
120144
transfer-encoding:
121145
- chunked
122146
x-processing-time:
123-
- 11341ms
147+
- 18600ms
124148
status:
125149
code: 200
126150
message: OK

sdk/communication/azure-communication-phonenumbers/test/recordings/test_phone_number_administration_client.test_list_purchased_phone_numbers_from_managed_identity.yaml

Lines changed: 37 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,33 @@ interactions:
99
Connection:
1010
- keep-alive
1111
User-Agent:
12-
- azsdk-python-communication-phonenumbers/1.0.0b5 Python/3.8.5 (Windows-10-10.0.19041-SP0)
12+
- azsdk-python-communication-phonenumbers/1.0.0b5 Python/3.9.0 (Windows-10-10.0.19041-SP0)
1313
method: GET
1414
uri: https://sanitized.communication.azure.com/phoneNumbers?skip=0&top=100&api-version=2021-03-07
1515
response:
1616
body:
1717
string: '{"phoneNumbers": [{"id": "sanitized", "phoneNumber": "sanitized", "countryCode":
18-
"US", "phoneNumberType": "geographic", "capabilities": {"calling": "outbound",
19-
"sms": "none"}, "assignmentType": "application", "purchaseDate": "2021-04-06T23:27:52.858607+00:00",
18+
"US", "phoneNumberType": "geographic", "capabilities": {"calling": "inbound+outbound",
19+
"sms": "none"}, "assignmentType": "application", "purchaseDate": "2021-04-14T00:23:52.1861991+00:00",
2020
"cost": {"amount": 1.0, "currencyCode": "USD", "billingFrequency": "monthly"}},
2121
{"id": "sanitized", "phoneNumber": "sanitized", "countryCode": "US", "phoneNumberType":
2222
"geographic", "capabilities": {"calling": "inbound", "sms": "none"}, "assignmentType":
23+
"application", "purchaseDate": "2021-04-14T21:31:30.9566555+00:00", "cost":
24+
{"amount": 1.0, "currencyCode": "USD", "billingFrequency": "monthly"}}, {"id":
25+
"sanitized", "phoneNumber": "sanitized", "countryCode": "US", "phoneNumberType":
26+
"geographic", "capabilities": {"calling": "outbound", "sms": "none"}, "assignmentType":
27+
"application", "purchaseDate": "2021-04-06T23:27:52.858607+00:00", "cost":
28+
{"amount": 1.0, "currencyCode": "USD", "billingFrequency": "monthly"}}, {"id":
29+
"sanitized", "phoneNumber": "sanitized", "countryCode": "US", "phoneNumberType":
30+
"geographic", "capabilities": {"calling": "inbound", "sms": "none"}, "assignmentType":
2331
"application", "purchaseDate": "2021-04-06T23:48:49.38583+00:00", "cost":
2432
{"amount": 1.0, "currencyCode": "USD", "billingFrequency": "monthly"}}, {"id":
2533
"sanitized", "phoneNumber": "sanitized", "countryCode": "US", "phoneNumberType":
2634
"tollFree", "capabilities": {"calling": "none", "sms": "inbound+outbound"},
2735
"assignmentType": "application", "purchaseDate": "2021-02-10T17:51:13.4876763+00:00",
2836
"cost": {"amount": 2.0, "currencyCode": "USD", "billingFrequency": "monthly"}},
2937
{"id": "sanitized", "phoneNumber": "sanitized", "countryCode": "US", "phoneNumberType":
30-
"tollFree", "capabilities": {"calling": "none", "sms": "inbound"}, "assignmentType":
38+
"tollFree", "capabilities": {"calling": "none", "sms": "outbound"}, "assignmentType":
3139
"application", "purchaseDate": "2021-02-10T17:52:41.818335+00:00", "cost":
3240
{"amount": 2.0, "currencyCode": "USD", "billingFrequency": "monthly"}}, {"id":
3341
"sanitized", "phoneNumber": "sanitized", "countryCode": "US", "phoneNumberType":
@@ -51,11 +59,11 @@ interactions:
5159
"application", "purchaseDate": "2021-03-26T20:48:35.6663829+00:00", "cost":
5260
{"amount": 2.0, "currencyCode": "USD", "billingFrequency": "monthly"}}, {"id":
5361
"sanitized", "phoneNumber": "sanitized", "countryCode": "US", "phoneNumberType":
54-
"tollFree", "capabilities": {"calling": "inbound+outbound", "sms": "inbound+outbound"},
55-
"assignmentType": "application", "purchaseDate": "2021-03-26T22:41:03.6935096+00:00",
56-
"cost": {"amount": 2.0, "currencyCode": "USD", "billingFrequency": "monthly"}},
57-
{"id": "sanitized", "phoneNumber": "sanitized", "countryCode": "US", "phoneNumberType":
58-
"tollFree", "capabilities": {"calling": "inbound", "sms": "inbound+outbound"},
62+
"tollFree", "capabilities": {"calling": "none", "sms": "outbound"}, "assignmentType":
63+
"application", "purchaseDate": "2021-03-26T22:41:03.6935096+00:00", "cost":
64+
{"amount": 2.0, "currencyCode": "USD", "billingFrequency": "monthly"}}, {"id":
65+
"sanitized", "phoneNumber": "sanitized", "countryCode": "US", "phoneNumberType":
66+
"tollFree", "capabilities": {"calling": "inbound+outbound", "sms": "none"},
5967
"assignmentType": "application", "purchaseDate": "2021-03-29T20:13:20.1694649+00:00",
6068
"cost": {"amount": 2.0, "currencyCode": "USD", "billingFrequency": "monthly"}},
6169
{"id": "sanitized", "phoneNumber": "sanitized", "countryCode": "US", "phoneNumberType":
@@ -100,23 +108,39 @@ interactions:
100108
"cost": {"amount": 2.0, "currencyCode": "USD", "billingFrequency": "monthly"}},
101109
{"id": "sanitized", "phoneNumber": "sanitized", "countryCode": "US", "phoneNumberType":
102110
"tollFree", "capabilities": {"calling": "inbound", "sms": "inbound+outbound"},
111+
"assignmentType": "application", "purchaseDate": "2021-04-08T16:18:38.5365335+00:00",
112+
"cost": {"amount": 2.0, "currencyCode": "USD", "billingFrequency": "monthly"}},
113+
{"id": "sanitized", "phoneNumber": "sanitized", "countryCode": "US", "phoneNumberType":
114+
"tollFree", "capabilities": {"calling": "inbound", "sms": "inbound+outbound"},
115+
"assignmentType": "application", "purchaseDate": "2021-04-08T19:48:38.3328121+00:00",
116+
"cost": {"amount": 2.0, "currencyCode": "USD", "billingFrequency": "monthly"}},
117+
{"id": "sanitized", "phoneNumber": "sanitized", "countryCode": "US", "phoneNumberType":
118+
"tollFree", "capabilities": {"calling": "inbound", "sms": "inbound+outbound"},
119+
"assignmentType": "application", "purchaseDate": "2021-04-08T20:56:52.3906615+00:00",
120+
"cost": {"amount": 2.0, "currencyCode": "USD", "billingFrequency": "monthly"}},
121+
{"id": "sanitized", "phoneNumber": "sanitized", "countryCode": "US", "phoneNumberType":
122+
"tollFree", "capabilities": {"calling": "inbound", "sms": "inbound+outbound"},
103123
"assignmentType": "application", "purchaseDate": "2000-01-01T00:00:00+00:00",
104-
"cost": {"amount": 2.0, "currencyCode": "USD", "billingFrequency": "monthly"}}]}'
124+
"cost": {"amount": 2.0, "currencyCode": "USD", "billingFrequency": "monthly"}},
125+
{"id": "sanitized", "phoneNumber": "sanitized", "countryCode": "US", "phoneNumberType":
126+
"geographic", "capabilities": {"calling": "inbound+outbound", "sms": "none"},
127+
"assignmentType": "application", "purchaseDate": "2021-04-14T15:50:33.2361831+00:00",
128+
"cost": {"amount": 1.0, "currencyCode": "USD", "billingFrequency": "monthly"}}]}'
105129
headers:
106130
api-supported-versions:
107131
- '2021-03-07'
108132
content-type:
109133
- application/json; charset=utf-8
110134
date:
111-
- Wed, 07 Apr 2021 18:27:23 GMT
135+
- Mon, 19 Apr 2021 21:49:44 GMT
112136
ms-cv:
113-
- rv8mZus1AUu043QAeJv22Q.0
137+
- 0Z8gtvI0QU23MCk18CE4JA.0
114138
request-context:
115139
- appId=
116140
transfer-encoding:
117141
- chunked
118142
x-processing-time:
119-
- 15045ms
143+
- 30850ms
120144
status:
121145
code: 200
122146
message: OK
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
interactions:
2+
- request:
3+
body: '{"phoneNumberType": "tollFree", "assignmentType": "application", "capabilities":
4+
{"calling": "inbound", "sms": "inbound+outbound"}}'
5+
headers:
6+
Accept:
7+
- application/json
8+
Accept-Encoding:
9+
- gzip, deflate
10+
Connection:
11+
- keep-alive
12+
Content-Length:
13+
- '131'
14+
Content-Type:
15+
- application/json
16+
Date:
17+
- Mon, 19 Apr 2021 21:49:44 GMT
18+
User-Agent:
19+
- azsdk-python-communication-phonenumbers/1.0.0b5 Python/3.9.0 (Windows-10-10.0.19041-SP0)
20+
x-ms-return-client-request-id:
21+
- 'true'
22+
method: POST
23+
uri: https://sanitized.communication.azure.com/availablePhoneNumbers/countries/XX/:search?api-version=2021-03-07
24+
response:
25+
body:
26+
string: '{"error": {"code": "InvalidInput", "message": "Unable to parse country
27+
code.", "target": "countrycode"}}'
28+
headers:
29+
api-supported-versions:
30+
- '2021-03-07'
31+
content-type:
32+
- application/json
33+
date:
34+
- Mon, 19 Apr 2021 21:49:44 GMT
35+
ms-cv:
36+
- tAckLoEl7Uyqg0NYT97njA.0
37+
request-context:
38+
- appId=
39+
transfer-encoding:
40+
- chunked
41+
x-processing-time:
42+
- 13ms
43+
status:
44+
code: 400
45+
message: Bad Request
46+
url: sanitized
47+
version: 1

0 commit comments

Comments
 (0)