Actually check output file contents in to test_encrypt_*() tests.

This provides more accurate testing for issues like #93.
fix/93-encrypt-to-stream
Isis Lovecruft 2015-03-13 03:44:12 +00:00
parent 8579331562
commit 6d1890389c
No known key found for this signature in database
GPG Key ID: 18C16EC5F9F1D673
1 changed files with 4 additions and 4 deletions

View File

@ -1152,9 +1152,9 @@ know, maybe you shouldn't be doing it in the first place.
self.assertTrue(os.path.isfile(output))
# Check the contents:
with open(output) as fh:
with open(output, 'rb') as fh:
encrypted_message = fh.read()
log.debug("Encrypted file contains:\n\n%s\n" % encrypted_message)
self.assertTrue(b"-----BEGIN PGP MESSAGE-----" in encrypted_message)
def test_encryption_to_filehandle(self):
"""Test that ``encrypt(..., output=filelikething)`` is successful."""
@ -1174,9 +1174,9 @@ know, maybe you shouldn't be doing it in the first place.
self.assertTrue(os.path.isfile(output))
# Check the contents:
with open(output) as fh:
with open(output, 'rb') as fh:
encrypted_message = fh.read()
log.debug("Encrypted file contains:\n\n%s\n" % encrypted_message)
self.assertTrue(b"-----BEGIN PGP MESSAGE-----" in encrypted_message)
def test_encryption_from_filehandle(self):
"""Test that ``encrypt(open('foo'), ...)`` is successful."""