@@ -812,6 +812,33 @@ def test_builder_set_remote_url_no_embed(self):
812812 # Return back to default settings
813813 load_settings (r'{"verify": { "remote_manifest_fetch": true} }' )
814814
815+ def test_sign_single_file (self ):
816+ """Test signing a file using the sign_file method."""
817+ # Create a temporary directory for the test
818+ temp_dir = tempfile .mkdtemp ()
819+ try :
820+ # Create a temporary output file path
821+ output_path = os .path .join (temp_dir , "signed_output.jpg" )
822+
823+ # Use the sign_file method
824+ builder = Builder (self .manifestDefinition )
825+ output = io .BytesIO (bytearray ())
826+
827+ with open (self .testPath , "rb" ) as file :
828+ builder .sign (self .signer , "image/jpeg" , file , output )
829+ output .seek (0 )
830+
831+ # Read the signed file and verify the manifest
832+ reader = Reader ("image/jpeg" , output )
833+ json_data = reader .json ()
834+ self .assertIn ("Python Test" , json_data )
835+ self .assertNotIn ("validation_status" , json_data )
836+ output .close ()
837+
838+ finally :
839+ # Clean up the temporary directory
840+ shutil .rmtree (temp_dir )
841+
815842 def test_sign_file (self ):
816843 """Test signing a file using the sign_file method."""
817844 # Create a temporary directory for the test
@@ -823,9 +850,9 @@ def test_sign_file(self):
823850 # Use the sign_file method
824851 builder = Builder (self .manifestDefinition )
825852 manifest_bytes = builder .sign_file (
826- source_path = self .testPath ,
827- dest_path = output_path ,
828- signer = self .signer
853+ self .testPath ,
854+ output_path ,
855+ self .signer
829856 )
830857
831858 # Verify the output file was created
0 commit comments