summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLucas Hoffmann <l-m-h@web.de>2017-06-08 17:59:58 +0200
committerLucas Hoffmann <l-m-h@web.de>2017-06-21 09:17:55 +0200
commitde644b55de6f46cd9477ab212dafa625036e94d2 (patch)
treea0112cd27a48751ebcb2ad6aad513224086ee785 /tests
parent988788f48b6e009deaec3b28d9c85bde2b365f35 (diff)
Add crypto tests that don't need a keyring
Diffstat (limited to 'tests')
-rw-r--r--tests/crypto_test.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/crypto_test.py b/tests/crypto_test.py
new file mode 100644
index 00000000..156d4ad6
--- /dev/null
+++ b/tests/crypto_test.py
@@ -0,0 +1,28 @@
+# Copyright (C) 2017 Lucas Hoffmann
+# This file is released under the GNU GPL, version 3 or a later revision.
+# For further details see the COPYING file
+from __future__ import absolute_import
+
+import unittest
+
+import gpgme
+
+from alot import crypto
+from alot.errors import GPGProblem
+
+
+class TestHashAlgorithmHelper(unittest.TestCase):
+
+ """Test cases for the helper function RFC3156_canonicalize."""
+
+ def test_returned_string_starts_with_pgp(self):
+ result = crypto.RFC3156_micalg_from_algo(gpgme.MD_MD5)
+ self.assertTrue(result.startswith('pgp-'))
+
+ def test_returned_string_is_lower_case(self):
+ result = crypto.RFC3156_micalg_from_algo(gpgme.MD_MD5)
+ self.assertTrue(result.islower())
+
+ def test_raises_for_unknown_hash_name(self):
+ with self.assertRaises(GPGProblem):
+ crypto.RFC3156_micalg_from_algo(gpgme.MD_NONE)