@@ -659,7 +659,10 @@ fn create_server(key_pair: KeyPair) -> rocket::Rocket<rocket::Build> {
659
659
. mount ( "/" , routes ! [ index] )
660
660
. mount ( "/" , routes ! [ get_list, get_pcf_unauth, post_event_fallback] )
661
661
. mount ( "/" , routes ! [ openid_configuration, jwks] )
662
- . mount ( "/" , routes ! [ shipment_footprint_schema, toc_schema, hoc_schema] )
662
+ . mount (
663
+ "/" ,
664
+ routes ! [ shipment_footprint_schema, toc_schema, hoc_schema] ,
665
+ )
663
666
. mount ( "/auth" , routes ! [ oauth2_create_token] )
664
667
. mount (
665
668
"/swagger-ui/" ,
@@ -1340,3 +1343,30 @@ fn get_tad_with_limit_and_filter_test() {
1340
1343
resp. into_string( ) . unwrap( )
1341
1344
) ;
1342
1345
}
1346
+
1347
+ #[ test]
1348
+ fn schema_jsons_test ( ) {
1349
+ let client = & Client :: tracked ( create_server ( TEST_KEYPAIR . clone ( ) ) ) . unwrap ( ) ;
1350
+
1351
+ fn test_schema ( client : & Client , schema_url : & str , schema : RootSchema ) {
1352
+ let schema_resp = client. get ( schema_url) . dispatch ( ) ;
1353
+
1354
+ assert_eq ! ( schema_resp. status( ) , rocket:: http:: Status :: Ok ) ;
1355
+
1356
+ let fetched_schema = schema_resp. into_json :: < RootSchema > ( ) ;
1357
+
1358
+ assert_eq ! ( fetched_schema. unwrap( ) , schema) ;
1359
+ }
1360
+
1361
+ let ship_foot_schema_url = "/shipment-footprint.json" ;
1362
+ let ship_foot_schema = schema_for ! ( ShipmentFootprint ) ;
1363
+ test_schema ( client, ship_foot_schema_url, ship_foot_schema) ;
1364
+
1365
+ let toc_schema_url: & str = "/toc.json" ;
1366
+ let toc_schema = schema_for ! ( Toc ) ;
1367
+ test_schema ( client, toc_schema_url, toc_schema) ;
1368
+
1369
+ let hoc_schema_url = "/hoc.json" ;
1370
+ let hoc_schema = schema_for ! ( Hoc ) ;
1371
+ test_schema ( client, hoc_schema_url, hoc_schema) ;
1372
+ }
0 commit comments