Skip to content

Commit 4f58367

Browse files
committed
fix: Bindings tests
1 parent d0a6d36 commit 4f58367

File tree

1 file changed

+29
-30
lines changed

1 file changed

+29
-30
lines changed

tests/test_unit_tests.py

Lines changed: 29 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -342,31 +342,6 @@ def test_reader_state_with_invalid_native_pointer(self):
342342
with self.assertRaises(Error):
343343
reader.json()
344344

345-
# TODO: Unskip once fixed configuration to read data is clarified
346-
# def test_read_cawg_data_file(self):
347-
# """Test reading C2PA metadata from C_with_CAWG_data.jpg file."""
348-
# file_path = os.path.join(self.data_dir, "C_with_CAWG_data.jpg")
349-
350-
# with open(file_path, "rb") as file:
351-
# reader = Reader("image/jpeg", file)
352-
# json_data = reader.json()
353-
# self.assertIsInstance(json_data, str)
354-
355-
# # Parse the JSON and verify specific fields
356-
# manifest_data = json.loads(json_data)
357-
358-
# # Verify basic manifest structure
359-
# self.assertIn("manifests", manifest_data)
360-
# self.assertIn("active_manifest", manifest_data)
361-
362-
# # Get the active manifest
363-
# active_manifest_id = manifest_data["active_manifest"]
364-
# active_manifest = manifest_data["manifests"][active_manifest_id]
365-
366-
# # Verify manifest is not null or empty
367-
# assert active_manifest is not None, "Active manifest should not be null"
368-
# assert len(active_manifest) > 0, "Active manifest should not be empty"
369-
370345
def test_reader_is_embedded(self):
371346
"""Test the is_embedded method returns correct values for embedded and remote manifests."""
372347

@@ -415,7 +390,6 @@ def test_reader_is_embedded(self):
415390
]
416391
}
417392

418-
# Test remote manifest
419393
with open(self.testPath, "rb") as file:
420394
builder = Builder(manifest_definition)
421395
builder.set_no_embed()
@@ -431,17 +405,42 @@ def test_reader_is_embedded(self):
431405
def test_reader_get_remote_url(self):
432406
"""Test the get_remote_url method returns correct values for embedded and remote manifests."""
433407

434-
# Test embedded manifest (should return None)
408+
# Test get_remote_url for file with embedded manifest (should return None)
435409
with open(self.testPath, "rb") as file:
436410
reader = Reader("image/jpeg", file)
437-
self.assertIsNone(reader.get_remote_url(), "Embedded manifest should return None for remote URL")
411+
self.assertIsNone(reader.get_remote_url())
438412
reader.close()
439413

440414
# Test remote manifest using cloud.jpg fixture which has a remote URL
441-
cloud_fixture_path = os.path.join(self.data_dir, "files-for-reading-tests", "cloud.jpg")
415+
cloud_fixture_path = os.path.join(self.data_dir, "cloud.jpg")
442416
with Reader("image/jpeg", cloud_fixture_path) as reader:
443417
remote_url = reader.get_remote_url()
444-
self.assertFalse(reader.is_embedded(), "This should be a remote manifest")
418+
self.assertFalse(reader.is_embedded())
419+
420+
# TODO: Unskip once fixed configuration to read data is clarified
421+
# def test_read_cawg_data_file(self):
422+
# """Test reading C2PA metadata from C_with_CAWG_data.jpg file."""
423+
# file_path = os.path.join(self.data_dir, "C_with_CAWG_data.jpg")
424+
425+
# with open(file_path, "rb") as file:
426+
# reader = Reader("image/jpeg", file)
427+
# json_data = reader.json()
428+
# self.assertIsInstance(json_data, str)
429+
430+
# # Parse the JSON and verify specific fields
431+
# manifest_data = json.loads(json_data)
432+
433+
# # Verify basic manifest structure
434+
# self.assertIn("manifests", manifest_data)
435+
# self.assertIn("active_manifest", manifest_data)
436+
437+
# # Get the active manifest
438+
# active_manifest_id = manifest_data["active_manifest"]
439+
# active_manifest = manifest_data["manifests"][active_manifest_id]
440+
441+
# # Verify manifest is not null or empty
442+
# assert active_manifest is not None, "Active manifest should not be null"
443+
# assert len(active_manifest) > 0, "Active manifest should not be empty"
445444

446445

447446
class TestBuilderWithSigner(unittest.TestCase):

0 commit comments

Comments
 (0)