forked from lucee/extension-pdf
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a testcase to check for an invalid password with the action='re…
…movepassword' in cfpdf on LDEV-4694
- Loading branch information
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ); | ||
}; | ||
} |