@@ -3,12 +3,13 @@ use atlas_c2pa_lib::claim::ClaimV2;
33use atlas_c2pa_lib:: datetime_wrapper:: OffsetDateTimeWrapper ;
44use atlas_c2pa_lib:: ingredient:: { Ingredient , IngredientData , LinkedIngredient } ;
55use atlas_c2pa_lib:: manifest:: Manifest ;
6- use mockito:: mock ;
6+ use mockito:: Server ;
77use openssl:: sha:: sha256;
88use time:: OffsetDateTime ;
99
1010#[ test]
1111fn test_ingredient_linking_with_verification ( ) {
12+ let mut server = Server :: new ( ) ; // Create a new mock server
1213 let claim_generator = "c2pa-ml/0.1.0" . to_string ( ) ;
1314
1415 // Fixed timestamp for consistent hashing
@@ -22,14 +23,14 @@ fn test_ingredient_linking_with_verification() {
2223
2324 // Linked ingredient (that itself is a reference to another dataset or model)
2425 let linked_ingredient = LinkedIngredient {
25- url : mockito :: server_url ( ) + "/linked_ingredient.json" ,
26+ url : server . url ( ) + "/linked_ingredient.json" ,
2627 hash : "ab82708c91050a674c1b12e2d48f4b2dced1dd25b1132d3f59460ec39ecce664" . to_string ( ) , // We'll verify this later
2728 media_type : "application/json" . to_string ( ) ,
2829 } ;
2930
3031 // Main ingredient with a link to another ingredient
3132 let ingredient_data = IngredientData {
32- url : mockito :: server_url ( ) + "/ingredient.json" ,
33+ url : server . url ( ) + "/ingredient.json" ,
3334 alg : "sha256" . to_string ( ) ,
3435 hash : "ingredient_hash" . to_string ( ) ,
3536 data_types : vec ! [ AssetType :: ModelOpenVino ] ,
@@ -78,14 +79,16 @@ fn test_ingredient_linking_with_verification() {
7879 let _manifest_hash = hex:: encode ( sha256 ( manifest_json. as_bytes ( ) ) ) ;
7980
8081 // Mock the HTTP server to return the linked ingredient
81- let linked_ingredient_mock = mock ( "GET" , "/linked_ingredient.json" )
82+ let linked_ingredient_mock = server
83+ . mock ( "GET" , "/linked_ingredient.json" )
8284 . with_status ( 200 )
8385 . with_header ( "content-type" , "application/json" )
8486 . with_body ( "{ \" ingredient\" : \" linked\" }" ) // Simulated linked ingredient
8587 . create ( ) ;
8688
8789 // Mock the HTTP server to return the ingredient
88- let ingredient_mock = mock ( "GET" , "/ingredient.json" )
90+ let ingredient_mock = server
91+ . mock ( "GET" , "/ingredient.json" )
8992 . with_status ( 200 )
9093 . with_header ( "content-type" , "application/json" )
9194 . with_body ( manifest_json. clone ( ) ) // Return the serialized manifest
0 commit comments