@@ -120,6 +120,8 @@ async fn test_authed_write_and_read() {
120
120
#[ async_std:: test]
121
121
#[ cfg( not( tarpaulin_include) ) ]
122
122
async fn test_wrong_authed_write_and_read ( ) {
123
+ use http:: StatusCode ;
124
+
123
125
const TEST_NAME : & str = "test_wrong_authed_write_and_read" ;
124
126
125
127
run_test (
@@ -140,9 +142,9 @@ async fn test_wrong_authed_write_and_read() {
140
142
let write_result = client. query ( write_query) . await ;
141
143
assert_result_err ( & write_result) ;
142
144
match write_result {
143
- Err ( Error :: AuthorizationError ) => { }
145
+ Err ( Error :: ApiError ( code ) ) if code == StatusCode :: UNAUTHORIZED . as_u16 ( ) => { }
144
146
_ => panic ! (
145
- "Should be an AuthorizationError : {}" ,
147
+ "Should be an ApiError(UNAUTHORIZED) : {}" ,
146
148
write_result. unwrap_err( )
147
149
) ,
148
150
}
@@ -151,9 +153,9 @@ async fn test_wrong_authed_write_and_read() {
151
153
let read_result = client. query ( read_query) . await ;
152
154
assert_result_err ( & read_result) ;
153
155
match read_result {
154
- Err ( Error :: AuthorizationError ) => { }
156
+ Err ( Error :: ApiError ( code ) ) if code == StatusCode :: UNAUTHORIZED . as_u16 ( ) => { }
155
157
_ => panic ! (
156
- "Should be an AuthorizationError : {}" ,
158
+ "Should be an ApiError(UNAUTHORIZED) : {}" ,
157
159
read_result. unwrap_err( )
158
160
) ,
159
161
}
@@ -164,9 +166,9 @@ async fn test_wrong_authed_write_and_read() {
164
166
let read_result = client. query ( read_query) . await ;
165
167
assert_result_err ( & read_result) ;
166
168
match read_result {
167
- Err ( Error :: AuthenticationError ) => { }
169
+ Err ( Error :: ApiError ( code ) ) if code == StatusCode :: FORBIDDEN . as_u16 ( ) => { }
168
170
_ => panic ! (
169
- "Should be an AuthenticationError : {}" ,
171
+ "Should be an ApiError(UNAUTHENTICATED) : {}" ,
170
172
read_result. unwrap_err( )
171
173
) ,
172
174
}
@@ -190,6 +192,8 @@ async fn test_wrong_authed_write_and_read() {
190
192
#[ async_std:: test]
191
193
#[ cfg( not( tarpaulin_include) ) ]
192
194
async fn test_non_authed_write_and_read ( ) {
195
+ use http:: StatusCode ;
196
+
193
197
const TEST_NAME : & str = "test_non_authed_write_and_read" ;
194
198
195
199
run_test (
@@ -208,9 +212,9 @@ async fn test_non_authed_write_and_read() {
208
212
let write_result = non_authed_client. query ( write_query) . await ;
209
213
assert_result_err ( & write_result) ;
210
214
match write_result {
211
- Err ( Error :: AuthorizationError ) => { }
215
+ Err ( Error :: ApiError ( code ) ) if code == StatusCode :: UNAUTHORIZED . as_u16 ( ) => { }
212
216
_ => panic ! (
213
- "Should be an AuthorizationError : {}" ,
217
+ "Should be an ApiError(UNAUTHORIZED) : {}" ,
214
218
write_result. unwrap_err( )
215
219
) ,
216
220
}
@@ -220,9 +224,9 @@ async fn test_non_authed_write_and_read() {
220
224
221
225
assert_result_err ( & read_result) ;
222
226
match read_result {
223
- Err ( Error :: AuthorizationError ) => { }
227
+ Err ( Error :: ApiError ( code ) ) if code == StatusCode :: UNAUTHORIZED . as_u16 ( ) => { }
224
228
_ => panic ! (
225
- "Should be an AuthorizationError : {}" ,
229
+ "Should be an ApiError(UNAUTHORIZED) : {}" ,
226
230
read_result. unwrap_err( )
227
231
) ,
228
232
}
@@ -280,6 +284,8 @@ async fn test_write_and_read_field() {
280
284
#[ cfg( feature = "serde" ) ]
281
285
#[ cfg( not( tarpaulin_include) ) ]
282
286
async fn test_json_non_authed_read ( ) {
287
+ use http:: StatusCode ;
288
+
283
289
const TEST_NAME : & str = "test_json_non_authed_read" ;
284
290
285
291
run_test (
@@ -297,9 +303,9 @@ async fn test_json_non_authed_read() {
297
303
let read_result = non_authed_client. json_query ( read_query) . await ;
298
304
assert_result_err ( & read_result) ;
299
305
match read_result {
300
- Err ( Error :: AuthorizationError ) => { }
306
+ Err ( Error :: ApiError ( code ) ) if code == StatusCode :: UNAUTHORIZED . as_u16 ( ) => { }
301
307
_ => panic ! (
302
- "Should be a AuthorizationError : {}" ,
308
+ "Should be an ApiError(UNAUTHORIZED) : {}" ,
303
309
read_result. unwrap_err( )
304
310
) ,
305
311
}
0 commit comments