@@ -145,15 +145,19 @@ fn create_request(
145145 path : & str ,
146146 headers : Option < HashMap < & ' static str , String > > ,
147147 payload : Option < serde_json:: Value > ,
148- settings : Option < & Settings >
148+ settings : Option < & Settings > ,
149149) -> test:: TestRequest {
150150 let test_settings = get_test_settings ( ) ;
151151 let settings = settings. unwrap_or ( & test_settings) ;
152152 let mut req = test:: TestRequest :: with_uri ( path)
153153 . method ( method. clone ( ) )
154154 . insert_header ( (
155155 "Authorization" ,
156- create_hawk_header ( method. as_str ( ) , settings. port , & ( ReverseProxyState :: from_settings ( & settings) . get_webroot ( ) + path) ) ,
156+ create_hawk_header (
157+ method. as_str ( ) ,
158+ settings. port ,
159+ & ( ReverseProxyState :: from_settings ( & settings) . get_webroot ( ) + path) ,
160+ ) ,
157161 ) )
158162 . insert_header ( ( "Accept" , "application/json" ) )
159163 . insert_header ( (
@@ -237,9 +241,7 @@ async fn test_endpoint(
237241
238242 let app = match settings. clone ( ) {
239243 None => init_app ! ( ) . await ,
240- Some ( settings) => {
241- init_app ! ( settings) . await
242- }
244+ Some ( settings) => init_app ! ( settings) . await ,
243245 } ;
244246
245247 let req = create_request ( & method, path, None , None , settings. as_ref ( ) ) . to_request ( ) ;
@@ -539,7 +541,7 @@ async fn invalid_content_type() {
539541
540542 let mut headers = HashMap :: new ( ) ;
541543 headers. insert ( "Content-Type" , "application/javascript" . to_owned ( ) ) ;
542- let req = create_request (
544+ let req = create_request (
543545 & http:: Method :: PUT ,
544546 path,
545547 Some ( headers. clone ( ) ) ,
@@ -709,8 +711,14 @@ async fn reject_old_ios() {
709711#[ actix_rt:: test]
710712async fn info_configuration_xlm ( ) {
711713 let app = init_app ! ( ) . await ;
712- let req =
713- create_request ( & http:: Method :: GET , "/1.5/42/info/configuration" , None , None , None ) . to_request ( ) ;
714+ let req = create_request (
715+ & http:: Method :: GET ,
716+ "/1.5/42/info/configuration" ,
717+ None ,
718+ None ,
719+ None ,
720+ )
721+ . to_request ( ) ;
714722 let response = app. call ( req) . await . unwrap ( ) ;
715723 assert_eq ! ( response. status( ) , StatusCode :: OK ) ;
716724 let xlm = response. headers ( ) . get ( X_LAST_MODIFIED ) ;
@@ -734,7 +742,14 @@ async fn overquota() {
734742 let app = init_app ! ( settings) . await ;
735743
736744 // Clear out any data that's already in the store.
737- let req = create_request ( & http:: Method :: DELETE , "/1.5/42/storage" , None , None , Some ( & settings) ) . to_request ( ) ;
745+ let req = create_request (
746+ & http:: Method :: DELETE ,
747+ "/1.5/42/storage" ,
748+ None ,
749+ None ,
750+ Some ( & settings) ,
751+ )
752+ . to_request ( ) ;
738753 let resp = app. call ( req) . await . unwrap ( ) ;
739754 assert ! ( resp. response( ) . status( ) . is_success( ) ) ;
740755
@@ -785,7 +800,14 @@ async fn overquota() {
785800
786801 // XXX: this should run as cleanup regardless of test failure but it's
787802 // difficult. e.g. FutureExt::catch_unwind isn't compatible w/ actix-web
788- let req = create_request ( & http:: Method :: DELETE , "/1.5/42/storage" , None , None , Some ( & settings) ) . to_request ( ) ;
803+ let req = create_request (
804+ & http:: Method :: DELETE ,
805+ "/1.5/42/storage" ,
806+ None ,
807+ None ,
808+ Some ( & settings) ,
809+ )
810+ . to_request ( ) ;
789811 let resp = app. call ( req) . await . unwrap ( ) ;
790812 assert ! ( resp. response( ) . status( ) . is_success( ) ) ;
791813}
@@ -798,7 +820,14 @@ async fn lbheartbeat_max_pool_size_check() {
798820 let app = init_app ! ( settings) . await ;
799821
800822 // Test all is well.
801- let lb_req = create_request ( & http:: Method :: GET , "/__lbheartbeat__" , None , None , Some ( & settings) ) . to_request ( ) ;
823+ let lb_req = create_request (
824+ & http:: Method :: GET ,
825+ "/__lbheartbeat__" ,
826+ None ,
827+ None ,
828+ Some ( & settings) ,
829+ )
830+ . to_request ( ) ;
802831 let sresp = app. call ( lb_req) . await . unwrap ( ) ;
803832 let status = sresp. status ( ) ;
804833 // dbg!(status, test::read_body(sresp).await);
@@ -823,8 +852,14 @@ async fn lbheartbeat_max_pool_size_check() {
823852
824853 // check duration for exhausted connections
825854 actix_rt:: time:: sleep ( Duration :: from_secs ( 1 ) ) . await ;
826- let req =
827- create_request ( & http:: Method :: GET , "/__lbheartbeat__" , Some ( headers) , None , Some ( & settings) ) . to_request ( ) ;
855+ let req = create_request (
856+ & http:: Method :: GET ,
857+ "/__lbheartbeat__" ,
858+ Some ( headers) ,
859+ None ,
860+ Some ( & settings) ,
861+ )
862+ . to_request ( ) ;
828863 let sresp = app. call ( req) . await . unwrap ( ) ;
829864 let status = sresp. status ( ) ;
830865 let body = test:: read_body ( sresp) . await ;
@@ -838,8 +873,14 @@ async fn lbheartbeat_max_pool_size_check() {
838873 let mut headers: HashMap < & str , String > = HashMap :: new ( ) ;
839874 headers. insert ( "TEST_CONNECTIONS" , "5" . to_owned ( ) ) ;
840875 headers. insert ( "TEST_IDLES" , "5" . to_owned ( ) ) ;
841- let req =
842- create_request ( & http:: Method :: GET , "/__lbheartbeat__" , Some ( headers) , None , Some ( & settings) ) . to_request ( ) ;
876+ let req = create_request (
877+ & http:: Method :: GET ,
878+ "/__lbheartbeat__" ,
879+ Some ( headers) ,
880+ None ,
881+ Some ( & settings) ,
882+ )
883+ . to_request ( ) ;
843884 let sresp = app. call ( req) . await . unwrap ( ) ;
844885 let status = sresp. status ( ) ;
845886 // dbg!(status, test::read_body(sresp).await);
@@ -854,13 +895,27 @@ async fn lbheartbeat_ttl_check() {
854895
855896 let app = init_app ! ( settings) . await ;
856897
857- let lb_req = create_request ( & http:: Method :: GET , "/__lbheartbeat__" , None , None , Some ( & settings) ) . to_request ( ) ;
898+ let lb_req = create_request (
899+ & http:: Method :: GET ,
900+ "/__lbheartbeat__" ,
901+ None ,
902+ None ,
903+ Some ( & settings) ,
904+ )
905+ . to_request ( ) ;
858906 let sresp = app. call ( lb_req) . await . unwrap ( ) ;
859907 assert ! ( sresp. status( ) . is_success( ) ) ;
860908
861909 actix_rt:: time:: sleep ( Duration :: from_secs ( 3 ) ) . await ;
862910
863- let lb_req = create_request ( & http:: Method :: GET , "/__lbheartbeat__" , None , None , Some ( & settings) ) . to_request ( ) ;
911+ let lb_req = create_request (
912+ & http:: Method :: GET ,
913+ "/__lbheartbeat__" ,
914+ None ,
915+ None ,
916+ Some ( & settings) ,
917+ )
918+ . to_request ( ) ;
864919 let sresp = app. call ( lb_req) . await . unwrap ( ) ;
865920 assert_eq ! ( sresp. status( ) , StatusCode :: INTERNAL_SERVER_ERROR ) ;
866921}
0 commit comments