[tor-commits] [bridgedb/develop] Add unittest for hotfix/11522 in commit fafbdc77a.

isis at torproject.org isis at torproject.org
Wed May 14 03:42:28 UTC 2014


commit 4b1450a3a11ac2ddda582e1684317230681d1fcf
Author: Isis Lovecruft <isis at torproject.org>
Date:   Wed Apr 23 03:14:20 2014 +0000

    Add unittest for hotfix/11522 in commit fafbdc77a.
---
 lib/bridgedb/test/test_crypto.py |   23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/lib/bridgedb/test/test_crypto.py b/lib/bridgedb/test/test_crypto.py
index 238002d..983b09d 100644
--- a/lib/bridgedb/test/test_crypto.py
+++ b/lib/bridgedb/test/test_crypto.py
@@ -14,6 +14,8 @@
 from __future__ import print_function
 from __future__ import unicode_literals
 
+import gpgme
+import io
 import logging
 import os
 import shutil
@@ -83,6 +85,27 @@ class GetKeyTests(unittest.TestCase):
                          % (key.encode('hex'), SEKRIT_KEY.encode('hex')))
 
 
+class LessCrypticGPGMEErrorTests(unittest.TestCase):
+    """Unittests for :class:`bridgedb.crypto.LessCrypticGPGMEError`."""
+
+    def test_error1(self):
+        """libgpgme will raise an error when given an io.StringIO for the
+        message or sigfile.
+        """
+        message = io.StringIO(unicode(self.id()))
+        sigfile = io.StringIO()
+
+        lessCryptic = None
+        ctx = gpgme.Context()
+
+        try:
+            ctx.sign(message, sigfile)
+        except gpgme.GpgmeError as error:
+            lessCryptic = crypto.LessCrypticGPGMEError(error)
+
+        self.assertTrue('Invalid argument' in lessCryptic.message)
+
+
 class SSLVerifyingContextFactoryTests(unittest.TestCase,
                                       txtagent.FakeReactorAndConnectMixin):
     """Tests for :class:`bridgedb.crypto.SSLVerifyingContextFactory`."""





More information about the tor-commits mailing list