chore: slight improvement of the encrypt feature to be more in line with others features

This commit is contained in:
Julien Neuhart
2025-05-28 15:21:41 +02:00
parent 99307befdd
commit ba944f9dc2
19 changed files with 318 additions and 797 deletions

View File

@@ -284,61 +284,3 @@ Feature: /forms/pdfengines/{write|read}
| files | teststore/foo.pdf | file |
Then the response status code should be 200
Then the response header "Content-Type" should be "application/json"
Scenario: POST /forms/pdfengines/metadata/write with encryption (user password only)
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/pdfengines/metadata/write" endpoint with the following form data and header(s):
| files | testdata/page_1.pdf | file |
| metadata | {"Title":"Encrypted Sample","Author":"Test Author","Subject":"Test Subject"} | field |
| userPassword | test123 | field |
| Gotenberg-Output-Filename | encrypted | header |
Then the response status code should be 200
Then the response header "Content-Type" should be "application/pdf"
Then there should be 1 PDF(s) in the response
Then there should be the following file(s) in the response:
| encrypted.pdf |
Then the "encrypted.pdf" PDF should be encrypted
Scenario: POST /forms/pdfengines/metadata/write with encryption (user and owner passwords)
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/pdfengines/metadata/write" endpoint with the following form data and header(s):
| files | testdata/page_1.pdf | file |
| metadata | {"Title":"Encrypted Sample","Author":"Test Author","Subject":"Test Subject"} | field |
| userPassword | user123 | field |
| ownerPassword | owner456 | field |
| Gotenberg-Output-Filename | encrypted | header |
Then the response status code should be 200
Then the response header "Content-Type" should be "application/pdf"
Then there should be 1 PDF(s) in the response
Then there should be the following file(s) in the response:
| encrypted.pdf |
Then the "encrypted.pdf" PDF should be encrypted
Scenario: POST /forms/pdfengines/metadata/write with encryption (multiple files)
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/pdfengines/metadata/write" endpoint with the following form data and header(s):
| files | testdata/page_1.pdf | file |
| files | testdata/page_2.pdf | file |
| metadata | {"Title":"Encrypted Sample","Author":"Test Author","Subject":"Test Subject"} | field |
| userPassword | test123 | field |
| Gotenberg-Output-Filename | encrypted | header |
Then the response status code should be 200
Then the response header "Content-Type" should be "application/zip"
Then there should be the following file(s) in the response:
| encrypted.zip |
Then the response PDF(s) should be encrypted
Then the "encrypted.zip" archive should contain encrypted PDF file(s)
Scenario: POST /forms/pdfengines/metadata/write without encryption (empty password)
Given I have a default Gotenberg container
When I make a "POST" request to Gotenberg at the "/forms/pdfengines/metadata/write" endpoint with the following form data and header(s):
| files | testdata/page_1.pdf | file |
| metadata | {"Title":"Unencrypted Sample","Author":"Test Author","Subject":"Test Subject"} | field |
| userPassword | | field |
| Gotenberg-Output-Filename | unencrypted | header |
Then the response status code should be 200
Then the response header "Content-Type" should be "application/pdf"
Then there should be 1 PDF(s) in the response
Then there should be the following file(s) in the response:
| unencrypted.pdf |
Then the "unencrypted.pdf" PDF should NOT be encrypted