Skip to content

Commit

Permalink
Added a testcase to check for an invalid password with the action='re…
Browse files Browse the repository at this point in the history
…movepassword' in cfpdf on LDEV-4694
  • Loading branch information
cfmitrah committed Sep 27, 2023
1 parent df88397 commit 02f67da
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions tests/LDEV4694.cfc
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
component extends=org.lucee.cfml.test.LuceeTestCase {

function beforeAll() {
variables.testPdf = getTempFile( getTempDirectory(), "ldev4694", "pdf" );
variables.password = createUniqueID();

if( not fileExists('#testPdf#') ){
document format="pdf" filename="#testPdf#" overwrite=true {
echo(" ");
}
pdf action="protect" source="#testPdf#" newUserPassword="#password#";
}
}

function run( testResults , testBox ) {
describe( title="Testcase for LDEV-4694" , body=function() {
it( title="Checking for invalid password with action='removepassword' in cfpdf" , body=function( currentSpec ) {
expect( function(){
pdf action="removePassword" source=#testPdf# destination=#testPdf# password="invalidPassword" overwrite=true;
}).toThrow();
expect( fileExists( variables.testPdf ) ).toBeFalse();
});
});
}

function afterAll(){
if ( fileExists( variables.testPdf ) )
fileDelete( variables.testPdf );
};
}

0 comments on commit 02f67da

Please sign in to comment.