@@ -120,6 +120,8 @@ async fn test_authed_write_and_read() {
120120#[ async_std:: test]
121121#[ cfg( not( tarpaulin_include) ) ]
122122async fn test_wrong_authed_write_and_read ( ) {
123+ use http:: StatusCode ;
124+
123125 const TEST_NAME : & str = "test_wrong_authed_write_and_read" ;
124126
125127 run_test (
@@ -140,9 +142,9 @@ async fn test_wrong_authed_write_and_read() {
140142 let write_result = client. query ( write_query) . await ;
141143 assert_result_err ( & write_result) ;
142144 match write_result {
143- Err ( Error :: AuthorizationError ) => { }
145+ Err ( Error :: ApiError ( code ) ) if code == StatusCode :: UNAUTHORIZED . as_u16 ( ) => { }
144146 _ => panic ! (
145- "Should be an AuthorizationError : {}" ,
147+ "Should be an ApiError(UNAUTHORIZED) : {}" ,
146148 write_result. unwrap_err( )
147149 ) ,
148150 }
@@ -151,9 +153,9 @@ async fn test_wrong_authed_write_and_read() {
151153 let read_result = client. query ( read_query) . await ;
152154 assert_result_err ( & read_result) ;
153155 match read_result {
154- Err ( Error :: AuthorizationError ) => { }
156+ Err ( Error :: ApiError ( code ) ) if code == StatusCode :: UNAUTHORIZED . as_u16 ( ) => { }
155157 _ => panic ! (
156- "Should be an AuthorizationError : {}" ,
158+ "Should be an ApiError(UNAUTHORIZED) : {}" ,
157159 read_result. unwrap_err( )
158160 ) ,
159161 }
@@ -164,9 +166,9 @@ async fn test_wrong_authed_write_and_read() {
164166 let read_result = client. query ( read_query) . await ;
165167 assert_result_err ( & read_result) ;
166168 match read_result {
167- Err ( Error :: AuthenticationError ) => { }
169+ Err ( Error :: ApiError ( code ) ) if code == StatusCode :: FORBIDDEN . as_u16 ( ) => { }
168170 _ => panic ! (
169- "Should be an AuthenticationError : {}" ,
171+ "Should be an ApiError(UNAUTHENTICATED) : {}" ,
170172 read_result. unwrap_err( )
171173 ) ,
172174 }
@@ -190,6 +192,8 @@ async fn test_wrong_authed_write_and_read() {
190192#[ async_std:: test]
191193#[ cfg( not( tarpaulin_include) ) ]
192194async fn test_non_authed_write_and_read ( ) {
195+ use http:: StatusCode ;
196+
193197 const TEST_NAME : & str = "test_non_authed_write_and_read" ;
194198
195199 run_test (
@@ -208,9 +212,9 @@ async fn test_non_authed_write_and_read() {
208212 let write_result = non_authed_client. query ( write_query) . await ;
209213 assert_result_err ( & write_result) ;
210214 match write_result {
211- Err ( Error :: AuthorizationError ) => { }
215+ Err ( Error :: ApiError ( code ) ) if code == StatusCode :: UNAUTHORIZED . as_u16 ( ) => { }
212216 _ => panic ! (
213- "Should be an AuthorizationError : {}" ,
217+ "Should be an ApiError(UNAUTHORIZED) : {}" ,
214218 write_result. unwrap_err( )
215219 ) ,
216220 }
@@ -220,9 +224,9 @@ async fn test_non_authed_write_and_read() {
220224
221225 assert_result_err ( & read_result) ;
222226 match read_result {
223- Err ( Error :: AuthorizationError ) => { }
227+ Err ( Error :: ApiError ( code ) ) if code == StatusCode :: UNAUTHORIZED . as_u16 ( ) => { }
224228 _ => panic ! (
225- "Should be an AuthorizationError : {}" ,
229+ "Should be an ApiError(UNAUTHORIZED) : {}" ,
226230 read_result. unwrap_err( )
227231 ) ,
228232 }
@@ -280,6 +284,8 @@ async fn test_write_and_read_field() {
280284#[ cfg( feature = "serde" ) ]
281285#[ cfg( not( tarpaulin_include) ) ]
282286async fn test_json_non_authed_read ( ) {
287+ use http:: StatusCode ;
288+
283289 const TEST_NAME : & str = "test_json_non_authed_read" ;
284290
285291 run_test (
@@ -297,9 +303,9 @@ async fn test_json_non_authed_read() {
297303 let read_result = non_authed_client. json_query ( read_query) . await ;
298304 assert_result_err ( & read_result) ;
299305 match read_result {
300- Err ( Error :: AuthorizationError ) => { }
306+ Err ( Error :: ApiError ( code ) ) if code == StatusCode :: UNAUTHORIZED . as_u16 ( ) => { }
301307 _ => panic ! (
302- "Should be a AuthorizationError : {}" ,
308+ "Should be an ApiError(UNAUTHORIZED) : {}" ,
303309 read_result. unwrap_err( )
304310 ) ,
305311 }
0 commit comments