aboutsummaryrefslogtreecommitdiffstats
path: root/tests/primitives/test_hashes.py
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2013-10-21 21:32:21 -0700
committerAlex Gaynor <alex.gaynor@gmail.com>2013-10-21 21:32:21 -0700
commite524d73d76d63c6399a55cd80cec53cf39c98659 (patch)
tree7532b109bcddc17995f95b3178b52c739a626bd3 /tests/primitives/test_hashes.py
parentf3421788033b233d1aa51eae08c4fbe7b9748536 (diff)
parentd4cb34d51ae6695a6cda8e3b46eeb0b45a5935f1 (diff)
downloadcryptography-e524d73d76d63c6399a55cd80cec53cf39c98659.tar.gz
cryptography-e524d73d76d63c6399a55cd80cec53cf39c98659.tar.bz2
cryptography-e524d73d76d63c6399a55cd80cec53cf39c98659.zip
Merge pull request #147 from reaperhulk/hash-improvements
Provide data to hash 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,