From 6d1890389c7b4a8a6ab252c51bc9f95568ec4d84 Mon Sep 17 00:00:00 2001 From: Isis Lovecruft Date: Fri, 13 Mar 2015 03:44:12 +0000 Subject: [PATCH] Actually check output file contents in to test_encrypt_*() tests. This provides more accurate testing for issues like #93. --- gnupg/test/test_gnupg.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gnupg/test/test_gnupg.py b/gnupg/test/test_gnupg.py index 86491cc..d6bbb6e 100755 --- a/gnupg/test/test_gnupg.py +++ b/gnupg/test/test_gnupg.py @@ -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."""