Skip to content

Commit 6cda020

Browse files
committed
fix: Add one more test
1 parent cdf5ac3 commit 6cda020

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

tests/test_unit_tests.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,32 @@ def test_streams_sign_with_es256_alg_v1_manifest_to_file(self):
535535
if os.path.exists(temp_dir) and not os.listdir(temp_dir):
536536
os.rmdir(temp_dir)
537537

538+
def test_streams_sign_with_es256_alg_v1_manifest_to_new_dest_file(self):
539+
test_file_name = os.path.join(self.data_dir, "temp_data", "temp_signing.jpg")
540+
# Ensure tmp directory exists
541+
os.makedirs(os.path.dirname(test_file_name), exist_ok=True)
542+
543+
# A new target/destination file should be created during the test run
544+
try:
545+
with open(self.testPath, "rb") as source, open(test_file_name, "w+b") as target:
546+
builder = Builder(self.manifestDefinition)
547+
builder.sign(self.signer, "image/jpeg", source, target)
548+
reader = Reader("image/jpeg", target)
549+
json_data = reader.json()
550+
self.assertIn("Python Test", json_data)
551+
self.assertNotIn("validation_status", json_data)
552+
553+
finally:
554+
# Clean up...
555+
556+
if os.path.exists(test_file_name):
557+
os.remove(test_file_name)
558+
559+
# Also clean up the temp directory if it's empty
560+
temp_dir = os.path.dirname(test_file_name)
561+
if os.path.exists(temp_dir) and not os.listdir(temp_dir):
562+
os.rmdir(temp_dir)
563+
538564
def test_streams_sign_with_es256_alg(self):
539565
with open(self.testPath, "rb") as file:
540566
builder = Builder(self.manifestDefinitionV2)

0 commit comments

Comments
 (0)