From 763c6d6e5530d126888b8a8e4b40b92a96baa568 Mon Sep 17 00:00:00 2001 From: "James R. Barlow" Date: Tue, 18 Jun 2019 02:03:06 -0700 Subject: Allow testing PDF permissions from open files --- tests/resources/graph-encrypted.pdf | Bin 293636 -> 296661 bytes tests/test_pdf.py | 14 ++++++++++++++ 2 files changed, 14 insertions(+) (limited to 'tests') diff --git a/tests/resources/graph-encrypted.pdf b/tests/resources/graph-encrypted.pdf index 6e086af..6c9741e 100644 Binary files a/tests/resources/graph-encrypted.pdf and b/tests/resources/graph-encrypted.pdf differ diff --git a/tests/test_pdf.py b/tests/test_pdf.py index d9d7422..9e63893 100644 --- a/tests/test_pdf.py +++ b/tests/test_pdf.py @@ -84,6 +84,20 @@ class TestPasswords: Pdf.open(resources / 'graph-encrypted.pdf') +class TestPermissions: + def test_some_permissions_missing(self, resources): + pdf = Pdf.open(resources / 'graph-encrypted.pdf', 'owner') + assert ( + pdf.allow.modify_all + == pdf.allow.print_highres + == pdf.allow.modify_annotation + == False + ) + + def test_permissions_all_true_not_encrypted(self, trivial): + assert all(trivial.allow) + + class TestStreams: def test_stream(self, resources): with (resources / 'pal-1bit-trivial.pdf').open('rb') as stream: -- cgit v1.2.3