Skip to content

Commit

Permalink
LDEV-4692 test case for pdf protect / removePassword
Browse files Browse the repository at this point in the history
  • Loading branch information
zspitzer committed Sep 14, 2023
1 parent 7ca3dcd commit bf83a30
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 2 deletions.
4 changes: 2 additions & 2 deletions build.number
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#Build Number for ANT. Do not edit!
#Fri Sep 08 09:45:49 CEST 2023
build.number=7
#Thu Sep 14 09:02:27 CEST 2023
build.number=8
39 changes: 39 additions & 0 deletions tests/LDEV4692.cfc
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
component extends="org.lucee.cfml.test.LuceeTestCase" labels="pdf" {

function beforeAll() {

variables.testPdf = getTempFile( getTempDirectory(), "ldev4692", "pdf" );
variables.testCode = createUniqueID();
variables.password = createUniqueID();

document fileName="#testPdf#" overwrite="true" {
writeoutput(" test pdf file [#variables.testCode#]" );
}
}

function run( testResults , testBox ) {
describe( "testcase for LDEV-3048", function() {

it( title="cfpdf check password routines, protect, removePassword", body=function( currentSpec ) {

pdf action="extractText" source="#testPdf#" name="local.extractedText";
expect( extractedText ).toInclude( testCode );

pdf action="protect" source="#testPdf#" destination="#testPdf#" newUserPassword="#variables.password#" overwrite="true";
pdf action="extractText" source="#testPdf#" name="local.extractedText" password="#variables.password#";
expect( extractedText ).toInclude( testCode );

pdf action="removePassword" source="#testPdf#" destination="#testPdf#" password="#variables.password#" overwrite="true";
pdf action="extractText" source="#testPdf#" name="local.extractedText";
expect( extractedText ).toInclude( testCode );

});

});
}

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

0 comments on commit bf83a30

Please sign in to comment.