@@ -467,7 +467,14 @@ pub mod subscriptions {
467
467
#[ cfg( test) ]
468
468
mod tests {
469
469
use actix_http:: body:: AnyBody ;
470
- use actix_web:: { dev:: ServiceResponse , http, http:: header:: CONTENT_TYPE , test, web:: Data , App } ;
470
+ use actix_web:: {
471
+ dev:: ServiceResponse ,
472
+ http,
473
+ http:: header:: CONTENT_TYPE ,
474
+ test:: { self , TestRequest } ,
475
+ web:: Data ,
476
+ App ,
477
+ } ;
471
478
use juniper:: {
472
479
http:: tests:: { run_http_test_suite, HttpIntegration , TestResponse } ,
473
480
tests:: fixtures:: starwars:: schema:: { Database , Query } ,
@@ -509,7 +516,7 @@ mod tests {
509
516
}
510
517
let mut app =
511
518
test:: init_service ( App :: new ( ) . route ( "/" , web:: get ( ) . to ( graphql_handler) ) ) . await ;
512
- let req = test :: TestRequest :: get ( )
519
+ let req = TestRequest :: get ( )
513
520
. uri ( "/" )
514
521
. append_header ( ( ACCEPT , "text/html" ) )
515
522
. to_request ( ) ;
@@ -525,7 +532,7 @@ mod tests {
525
532
}
526
533
let mut app =
527
534
test:: init_service ( App :: new ( ) . route ( "/" , web:: get ( ) . to ( graphql_handler) ) ) . await ;
528
- let req = test :: TestRequest :: get ( )
535
+ let req = TestRequest :: get ( )
529
536
. uri ( "/" )
530
537
. append_header ( ( ACCEPT , "text/html" ) )
531
538
. to_request ( ) ;
@@ -550,7 +557,7 @@ mod tests {
550
557
}
551
558
let mut app =
552
559
test:: init_service ( App :: new ( ) . route ( "/" , web:: get ( ) . to ( graphql_handler) ) ) . await ;
553
- let req = test :: TestRequest :: get ( )
560
+ let req = TestRequest :: get ( )
554
561
. uri ( "/" )
555
562
. append_header ( ( ACCEPT , "text/html" ) )
556
563
. to_request ( ) ;
@@ -566,7 +573,7 @@ mod tests {
566
573
}
567
574
let mut app =
568
575
test:: init_service ( App :: new ( ) . route ( "/" , web:: get ( ) . to ( graphql_handler) ) ) . await ;
569
- let req = test :: TestRequest :: get ( )
576
+ let req = TestRequest :: get ( )
570
577
. uri ( "/" )
571
578
. append_header ( ( ACCEPT , "text/html" ) )
572
579
. to_request ( ) ;
@@ -589,7 +596,7 @@ mod tests {
589
596
EmptySubscription :: < Database > :: new ( ) ,
590
597
) ;
591
598
592
- let req = test :: TestRequest :: post ( )
599
+ let req = TestRequest :: post ( )
593
600
. append_header ( ( "content-type" , "application/json; charset=utf-8" ) )
594
601
. set_payload (
595
602
r##"{ "variables": null, "query": "{ hero(episode: NEW_HOPE) { name } }" }"## ,
@@ -625,7 +632,7 @@ mod tests {
625
632
EmptySubscription :: < Database > :: new ( ) ,
626
633
) ;
627
634
628
- let req = test :: TestRequest :: get ( )
635
+ let req = TestRequest :: get ( )
629
636
. append_header ( ( "content-type" , "application/json" ) )
630
637
. uri ( "/?query=%7B%20hero%28episode%3A%20NEW_HOPE%29%20%7B%20name%20%7D%20%7D&variables=null" )
631
638
. to_request ( ) ;
@@ -663,7 +670,7 @@ mod tests {
663
670
EmptySubscription :: < Database > :: new ( ) ,
664
671
) ;
665
672
666
- let req = test :: TestRequest :: post ( )
673
+ let req = TestRequest :: post ( )
667
674
. append_header ( ( "content-type" , "application/json" ) )
668
675
. set_payload (
669
676
r##"[
@@ -705,7 +712,7 @@ mod tests {
705
712
pub struct TestActixWebIntegration ;
706
713
707
714
impl TestActixWebIntegration {
708
- fn make_request ( & self , req : test :: TestRequest ) -> TestResponse {
715
+ fn make_request ( & self , req : TestRequest ) -> TestResponse {
709
716
actix_web:: rt:: System :: new ( ) . block_on ( async move {
710
717
let schema = Schema :: new (
711
718
Query ,
@@ -728,12 +735,12 @@ mod tests {
728
735
729
736
impl HttpIntegration for TestActixWebIntegration {
730
737
fn get ( & self , url : & str ) -> TestResponse {
731
- self . make_request ( test :: TestRequest :: get ( ) . uri ( url) )
738
+ self . make_request ( TestRequest :: get ( ) . uri ( url) )
732
739
}
733
740
734
741
fn post_json ( & self , url : & str , body : & str ) -> TestResponse {
735
742
self . make_request (
736
- test :: TestRequest :: post ( )
743
+ TestRequest :: post ( )
737
744
. append_header ( ( "content-type" , "application/json" ) )
738
745
. set_payload ( body. to_string ( ) )
739
746
. uri ( url) ,
@@ -742,7 +749,7 @@ mod tests {
742
749
743
750
fn post_graphql ( & self , url : & str , body : & str ) -> TestResponse {
744
751
self . make_request (
745
- test :: TestRequest :: post ( )
752
+ TestRequest :: post ( )
746
753
. append_header ( ( "content-type" , "application/graphql" ) )
747
754
. set_payload ( body. to_string ( ) )
748
755
. uri ( url) ,
0 commit comments