Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nolze committed Sep 11, 2018
1 parent b16cade commit 3c5cd5e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions msoffcrypto/format/xls97.py
Expand Up @@ -587,6 +587,18 @@ def decrypt(self, ofile):
return

def is_encrypted(self):
r'''
Test if the file is encrypted.
>>> f = open("tests/inputs/plain.xls", "rb")
>>> file = Xls97File(f)
>>> file.is_encrypted()
False
>>> f = open("tests/inputs/rc4cryptoapi_password.xls", "rb")
>>> file = Xls97File(f)
>>> file.is_encrypted()
True
'''
# Utilising the method above, check for encryption type.
self.data.workbook.seek(0)
workbook = _BIFFStream(self.data.workbook)
Expand Down
Binary file added tests/inputs/plain.xls
Binary file not shown.

0 comments on commit 3c5cd5e

Please sign in to comment.