@@ -11,6 +11,13 @@ use reqwest::Client;
1111
1212const TEST_IMAGES_PATH : & str = "tests/res" ;
1313
14+ fn init_tracing ( ) {
15+ let _ = tracing_subscriber:: fmt ( )
16+ . with_max_level ( tracing:: Level :: INFO )
17+ . with_test_writer ( ) // Output for tests
18+ . try_init ( ) ;
19+ }
20+
1421async fn upload_test_image ( root_url : & str , client : & Client , filename : & str , endpoint : & str ) -> Result < reqwest:: Response , reqwest:: Error > {
1522 let filepath = Path :: new ( TEST_IMAGES_PATH ) . join ( filename) ;
1623 assert ! ( filepath. exists( ) ) ;
@@ -165,14 +172,17 @@ mod test_uploading_image {
165172
166173 #[ tokio:: test]
167174 async fn test_upload_too_big_image_should_result_err ( ) {
175+ init_tracing ( ) ;
176+
168177 setup_server_environment_with_client ( |root_url, client| async move {
169178 let response = upload_test_image (
170179 & root_url,
171180 & client,
172181 "too_big_image_15_MB.png" ,
173182 "/api/upload"
174183 ) . await ;
175- assert ! ( response. is_err( ) ) ;
184+ tracing:: info!( "response: {:?}" , response) ;
185+ assert ! ( response. is_err( ) , "Response: {:?}" , response) ;
176186 } ) . await ;
177187 }
178188
@@ -200,7 +210,7 @@ mod test_uploading_image {
200210 "/api/upload"
201211 ) . await . unwrap ( ) ;
202212
203- assert ! ( !response. status( ) . is_success( ) , "Status: {}, response: {:?}" , response . status ( ) , response ) ;
213+ assert ! ( !response. status( ) . is_success( ) ) ;
204214 } ) . await ;
205215 }
206216
0 commit comments