Skip to content

Commit a2a6c9b

Browse files
fix: fix encrypted file test error code and remove duplicated encrypted file test
1 parent 53e5b70 commit a2a6c9b

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

sample-docs/failing-encrypted.pdf

-936 Bytes
Binary file not shown.

test_general/api/test_app.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -939,13 +939,13 @@ def test_encrypted_pdf():
939939
writer.encrypt(user_password="password123")
940940
writer.write(temp_file.name)
941941

942-
# Response should be 400
942+
# Response should be 422
943943
response = client.post(
944944
MAIN_API_ROUTE,
945945
files=[("files", (str(temp_file.name), open(temp_file.name, "rb"), "application/pdf"))],
946946
)
947947
assert response.json() == {"detail": "File is encrypted. Please decrypt it with password."}
948-
assert response.status_code == 400
948+
assert response.status_code == 422
949949

950950
# This file is owner encrypted, i.e. readable with edit restrictions
951951
writer = PdfWriter()
@@ -1160,7 +1160,6 @@ def test_include_slide_notes(monkeypatch, test_default, include_slide_notes, tes
11601160
@pytest.mark.parametrize(
11611161
("pdf_name", "expected_error_message"),
11621162
[
1163-
("failing-encrypted.pdf", "File is encrypted. Please decrypt it with password."),
11641163
(
11651164
"failing-invalid.pdf",
11661165
"File does not appear to be a valid PDF. Error: Stream has ended unexpectedly",

0 commit comments

Comments
 (0)