@@ -2,12 +2,14 @@ use actix_web::middleware::Logger;
22use actix_web:: web:: { Json , Path } ;
33use actix_web:: { App , Error } ;
44
5+ use actix_web:: test:: { call_service, init_service, try_read_body_json, TestRequest } ;
56use apistos:: app:: OpenApiWrapper ;
67use apistos:: spec:: Spec ;
78use apistos:: web:: { delete, get, patch, post, put, resource, scope, tagged_resource, tagged_scope, ServiceConfig } ;
89use apistos_gen:: api_operation;
910use apistos_models:: info:: Info ;
1011use apistos_models:: tag:: Tag ;
12+ use apistos_models:: OpenApi ;
1113
1214#[ actix_web:: test]
1315async fn actix_routing ( ) {
@@ -62,7 +64,8 @@ async fn actix_routing() {
6264 . route ( "test3" , patch ( ) . to ( test) )
6365 . route ( "test4/{test_id}" , patch ( ) . to ( test) )
6466 . app_data ( "" )
65- . configure ( my_routes) ,
67+ . configure ( my_routes)
68+ . service ( scope ( "test5" ) . route ( "" , post ( ) . to ( test) ) . route ( "" , get ( ) . to ( test) ) ) ,
6669 )
6770 . build ( "/openapi.json" ) ;
6871 let app = init_service ( app) . await ;
@@ -80,19 +83,20 @@ async fn actix_routing() {
8083 "/test/test2/" ,
8184 "/test/test3" ,
8285 "/test/test4/{test_id}" ,
86+ "/test/test5" ,
8387 "/test/users/{user_id}" ,
8488 "/test/{plop_id}/{clap_name}" ,
8589 ] ;
8690
87- assert_eq ! ( paths, expected_paths)
91+ assert_eq ! ( paths, expected_paths) ;
92+
93+ assert_eq ! ( body. paths. paths. values( ) . flat_map( |v| v. operations. values( ) ) . count( ) , 8 ) ;
8894}
8995
9096// Imports bellow aim at making clippy happy. Those dependencies are necessary for integration-test.
9197use actix_service as _;
92- use actix_web:: test:: { call_service, init_service, try_read_body_json, TestRequest } ;
9398use actix_web_lab as _;
9499use apistos_core as _;
95- use apistos_models:: OpenApi ;
96100use apistos_plugins as _;
97101use apistos_rapidoc as _;
98102use apistos_redoc as _;
0 commit comments