aboutsummaryrefslogtreecommitdiffstats
path: root/tests/primitives/test_hashes.py
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2013-10-19 23:05:12 -0500
committerPaul Kehrer <paul.l.kehrer@gmail.com>2013-10-19 23:17:00 -0500
commitd4cb34d51ae6695a6cda8e3b46eeb0b45a5935f1 (patch)
treed26ed4e241a32915aa8addccebaf9efbca3b71f7 /tests/primitives/test_hashes.py
parent746815b8f2b6a485b41e37c67969ed21338946db (diff)
downloadcryptography-d4cb34d51ae6695a6cda8e3b46eeb0b45a5935f1.tar.gz
cryptography-d4cb34d51ae6695a6cda8e3b46eeb0b45a5935f1.tar.bz2
cryptography-d4cb34d51ae6695a6cda8e3b46eeb0b45a5935f1.zip
Allow data to be passed in the constructor & reject unicode ala hashlib
Diffstat (limited to 'tests/primitives/test_hashes.py')
-rw-r--r--tests/primitives/test_hashes.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/primitives/test_hashes.py b/tests/primitives/test_hashes.py
index 901ddabb..805d992b 100644
--- a/tests/primitives/test_hashes.py
+++ b/tests/primitives/test_hashes.py
@@ -13,11 +13,22 @@
from __future__ import absolute_import, division, print_function
+import pytest
+
+import six
+
from cryptography.primitives import hashes
from .utils import generate_base_hash_test
+class TestBaseHash(object):
+ def test_base_hash_reject_unicode(self, api):
+ m = hashes.SHA1(api=api)
+ with pytest.raises(TypeError):
+ m.update(six.u("\u00FC"))
+
+
class TestSHA1(object):
test_SHA1 = generate_base_hash_test(
hashes.SHA1,