Skip to content

Commit 05967de

Browse files
committed
fix: Add test to verify PDF support
1 parent 4dc3831 commit 05967de

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed
-53.5 KB
Loading
Binary file not shown.

tests/test_unit_tests.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,30 @@ def test_read_cawg_data_file(self):
248248
assert active_manifest is not None, "Active manifest should not be null"
249249
assert len(active_manifest) > 0, "Active manifest should not be empty"
250250

251+
def test_read_known_pdf_file(self):
252+
"""Test reading C2PA metadata from adobe-20240110-single_manifest_store.pdf file."""
253+
file_path = os.path.join(self.data_dir, "known-files", "adobe-20240110-single_manifest_store.pdf")
254+
255+
with open(file_path, "rb") as file:
256+
reader = Reader("pdf", file)
257+
json_data = reader.json()
258+
self.assertIsInstance(json_data, str)
259+
260+
# Parse the JSON and verify specific fields
261+
manifest_data = json.loads(json_data)
262+
263+
# Verify basic manifest structure
264+
self.assertIn("manifests", manifest_data)
265+
self.assertIn("active_manifest", manifest_data)
266+
267+
# Get the active manifest
268+
active_manifest_id = manifest_data["active_manifest"]
269+
active_manifest = manifest_data["manifests"][active_manifest_id]
270+
271+
# Verify manifest is not null or empty
272+
assert active_manifest is not None, "Active manifest should not be null"
273+
assert len(active_manifest) > 0, "Active manifest should not be empty"
274+
251275

252276
class TestBuilder(unittest.TestCase):
253277
def setUp(self):

0 commit comments

Comments
 (0)