diff options
author | James R. Barlow <jim@purplerock.ca> | 2019-06-18 02:03:06 -0700 |
---|---|---|
committer | James R. Barlow <jim@purplerock.ca> | 2019-06-18 02:03:06 -0700 |
commit | 763c6d6e5530d126888b8a8e4b40b92a96baa568 (patch) | |
tree | b6847645e191de03922d5f0f508edb8471123a0f /tests | |
parent | 1259e353ca5ca85cd0c5990650d3f6fc1762f260 (diff) |
Allow testing PDF permissions from open files
Diffstat (limited to 'tests')
-rw-r--r-- | tests/resources/graph-encrypted.pdf | bin | 293636 -> 296661 bytes | |||
-rw-r--r-- | tests/test_pdf.py | 14 |
2 files changed, 14 insertions, 0 deletions
diff --git a/tests/resources/graph-encrypted.pdf b/tests/resources/graph-encrypted.pdf Binary files differindex 6e086af..6c9741e 100644 --- a/tests/resources/graph-encrypted.pdf +++ b/tests/resources/graph-encrypted.pdf 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: |