@@ -212,6 +212,35 @@ def test_read_all_files_using_extension(self):
212212 except Exception as e :
213213 self .fail (f"Failed to read metadata from { filename } : { str (e )} " )
214214
215+ def test_read_cawg_data_file (self ):
216+ """Test reading C2PA metadata from C_with_CAWG_data.jpg file."""
217+ file_path = os .path .join (self .data_dir , "files-for-reading-tests" , "C_with_CAWG_data.jpg" )
218+
219+ with open (file_path , "rb" ) as file :
220+ reader = Reader ("image/jpeg" , file )
221+ json_data = reader .json ()
222+ self .assertIsInstance (json_data , str )
223+
224+ # Parse the JSON and verify specific fields
225+ manifest_data = json .loads (json_data )
226+
227+ # Verify basic manifest structure
228+ self .assertIn ("manifests" , manifest_data )
229+ self .assertIn ("active_manifest" , manifest_data )
230+
231+ # Get the active manifest
232+ active_manifest_id = manifest_data ["active_manifest" ]
233+ active_manifest = manifest_data ["manifests" ][active_manifest_id ]
234+
235+ # Verify manifest contains expected fields
236+ self .assertIn ("title" , active_manifest )
237+ self .assertIn ("format" , active_manifest )
238+ self .assertIn ("claim_generator" , active_manifest )
239+ self .assertIn ("assertions" , active_manifest )
240+
241+ # Verify it's a JPEG file
242+ self .assertEqual (active_manifest ["format" ], "image/jpeg" )
243+
215244
216245class TestBuilder (unittest .TestCase ):
217246 def setUp (self ):
0 commit comments