Skip to content

Commit f52fbf3

Browse files
authored
[Communication] - SMS - adding assertion to verify error code 401 (Azure#20933)
* re adding assertion * adding test record
1 parent 687a9d8 commit f52fbf3

File tree

4 files changed

+17
-20
lines changed

4 files changed

+17
-20
lines changed

sdk/communication/azure-communication-sms/src/test/java/com/azure/communication/sms/SmsAsyncClientTests.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,8 @@ public void sendFromUnauthorizedNumber(HttpClient httpClient) {
150150
// Action & Assert
151151
Mono<SmsSendResult> response = asyncClient.send("+18007342577", TO_PHONE_NUMBER, MESSAGE);
152152
StepVerifier.create(response)
153-
.expectError().verify();
154-
// TODO: re-enable this when service change is made
155-
//.expectErrorMatches(exception ->
156-
// ((HttpResponseException) exception).getResponse().getStatusCode() == 401).verify();
153+
.expectErrorMatches(exception ->
154+
((HttpResponseException) exception).getResponse().getStatusCode() == 401).verify();
157155
}
158156

159157
@ParameterizedTest

sdk/communication/azure-communication-sms/src/test/java/com/azure/communication/sms/SmsClientTests.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,7 @@ public void sendFromUnauthorizedNumber(HttpClient httpClient) {
133133
SmsSendResult response = client.send("+18007342577", TO_PHONE_NUMBER, MESSAGE);
134134
} catch (Exception exception) {
135135
assertNotNull(((HttpResponseException) exception).getResponse().getStatusCode());
136-
// TODO: re-enable this when service change is made
137-
//assertEquals(401, ((HttpResponseException) exception).getResponse().getStatusCode());
136+
assertEquals(401, ((HttpResponseException) exception).getResponse().getStatusCode());
138137
}
139138
}
140139

sdk/communication/azure-communication-sms/src/test/resources/session-records/SmsAsyncClientTests.sendFromUnauthorizedNumber[1].json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@
33
"Method" : "POST",
44
"Uri" : "https://REDACTED.communication.azure.com/sms?api-version=2021-03-07",
55
"Headers" : {
6-
"User-Agent" : "azsdk-java-azure-communication-sms/1.0.0-beta.5 (11.0.8; Windows 10; 10.0)",
6+
"User-Agent" : "azsdk-java-azure-communication-sms/1.0.1 (15.0.1; Windows 10; 10.0)",
77
"Content-Type" : "application/json"
88
},
99
"Response" : {
10+
"content-length" : "0",
1011
"api-supported-versions" : "2020-07-20-preview1, 2020-08-20-preview, 2021-03-07",
11-
"X-Processing-Time" : "276ms",
12-
"MS-CV" : "02V0pMyhYEqt9Ppq6IsUzg.0",
12+
"X-Processing-Time" : "420ms",
13+
"MS-CV" : "MF1HkLIYBEeDxppDAHatnQ.0",
1314
"retry-after" : "0",
14-
"X-Azure-Ref" : "0FX5CYAAAAAD59GhqbPjwSYIPbDxPd0ORWVZSMzBFREdFMDQwOAA5ZmM3YjUxOS1hOGNjLTRmODktOTM1ZS1jOTE0OGFlMDllODE=",
15-
"Content-Length" : "0",
16-
"StatusCode" : "404",
17-
"Date" : "Fri, 05 Mar 2021 18:53:10 GMT",
15+
"X-Azure-Ref" : "0jiKDYAAAAACgf/mlrIJUQrgSthlobIR6TEFYRURHRTEyMDkAOWZjN2I1MTktYThjYy00Zjg5LTkzNWUtYzkxNDhhZTA5ZTgx",
16+
"StatusCode" : "401",
17+
"Date" : "Fri, 23 Apr 2021 19:39:58 GMT",
1818
"Request-Context" : "appId="
1919
},
2020
"Exception" : null

sdk/communication/azure-communication-sms/src/test/resources/session-records/SmsClientTests.sendFromUnauthorizedNumber[1].json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@
33
"Method" : "POST",
44
"Uri" : "https://REDACTED.communication.azure.com/sms?api-version=2021-03-07",
55
"Headers" : {
6-
"User-Agent" : "azsdk-java-azure-communication-sms/1.0.0-beta.5 (11.0.8; Windows 10; 10.0)",
6+
"User-Agent" : "azsdk-java-azure-communication-sms/1.0.1 (15.0.1; Windows 10; 10.0)",
77
"Content-Type" : "application/json"
88
},
99
"Response" : {
10+
"content-length" : "0",
1011
"api-supported-versions" : "2020-07-20-preview1, 2020-08-20-preview, 2021-03-07",
11-
"X-Processing-Time" : "279ms",
12-
"MS-CV" : "y0RQshIEZ0eA/g8YUeD8NA.0",
12+
"X-Processing-Time" : "488ms",
13+
"MS-CV" : "x/jt7fsoXESjpWKGCbETWA.0",
1314
"retry-after" : "0",
14-
"X-Azure-Ref" : "0c35CYAAAAABHcM9dqJCESLz3NefWeYBnWVZSMzBFREdFMDQxNQA5ZmM3YjUxOS1hOGNjLTRmODktOTM1ZS1jOTE0OGFlMDllODE=",
15-
"Content-Length" : "0",
16-
"StatusCode" : "404",
17-
"Date" : "Fri, 05 Mar 2021 18:54:42 GMT",
15+
"X-Azure-Ref" : "0KyKDYAAAAADxdvccxwkeSrdhXYtsDPjNTEFYRURHRTEyMTEAOWZjN2I1MTktYThjYy00Zjg5LTkzNWUtYzkxNDhhZTA5ZTgx",
16+
"StatusCode" : "401",
17+
"Date" : "Fri, 23 Apr 2021 19:38:19 GMT",
1818
"Request-Context" : "appId="
1919
},
2020
"Exception" : null

0 commit comments

Comments
 (0)