diff options
author | David Reid <dreid@dreid.org> | 2013-11-05 12:59:37 -0800 |
---|---|---|
committer | David Reid <dreid@dreid.org> | 2013-11-20 09:50:18 -0800 |
commit | 077e76e697ebf25aa9fd757f0ef1fd1251b7d408 (patch) | |
tree | 63f5d48206bee9575459ce604e3afde46910fe76 /tests/hazmat/primitives/test_hashes.py | |
parent | eb7f2a37fee0fdeb70f650b46f580b2eab6d0c05 (diff) | |
download | cryptography-077e76e697ebf25aa9fd757f0ef1fd1251b7d408.tar.gz cryptography-077e76e697ebf25aa9fd757f0ef1fd1251b7d408.tar.bz2 cryptography-077e76e697ebf25aa9fd757f0ef1fd1251b7d408.zip |
Explicit backend
Diffstat (limited to 'tests/hazmat/primitives/test_hashes.py')
-rw-r--r-- | tests/hazmat/primitives/test_hashes.py | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/tests/hazmat/primitives/test_hashes.py b/tests/hazmat/primitives/test_hashes.py index 367e764f..321082f6 100644 --- a/tests/hazmat/primitives/test_hashes.py +++ b/tests/hazmat/primitives/test_hashes.py @@ -20,7 +20,6 @@ import pytest import six from cryptography.exceptions import AlreadyFinalized -from cryptography.hazmat.bindings import _default_backend from cryptography.hazmat.primitives import hashes from .utils import generate_base_hash_test @@ -28,7 +27,7 @@ from .utils import generate_base_hash_test class TestHashContext(object): def test_hash_reject_unicode(self, backend): - m = hashes.Hash(hashes.SHA1(), backend=backend) + m = hashes.Hash(hashes.SHA1(), backend) with pytest.raises(TypeError): m.update(six.u("\u00FC")) @@ -36,24 +35,16 @@ class TestHashContext(object): pretend_backend = pretend.stub() copied_ctx = pretend.stub() pretend_ctx = pretend.stub(copy=lambda: copied_ctx) - h = hashes.Hash(hashes.SHA1(), backend=pretend_backend, - ctx=pretend_ctx) + h = hashes.Hash(hashes.SHA1(), pretend_backend, ctx=pretend_ctx) assert h._backend is pretend_backend assert h.copy()._backend is h._backend - def test_default_backend_creation(self): - """ - This test assumes the presence of SHA1 in the default backend. - """ - h = hashes.Hash(hashes.SHA1()) - assert h._backend is _default_backend - - def test_hash_algorithm_instance(self): + def test_hash_algorithm_instance(self, backend): with pytest.raises(TypeError): - hashes.Hash(hashes.SHA1) + hashes.Hash(hashes.SHA1, backend) - def test_raises_after_finalize(self): - h = hashes.Hash(hashes.SHA1()) + def test_raises_after_finalize(self, backend): + h = hashes.Hash(hashes.SHA1(), backend) h.finalize() with pytest.raises(AlreadyFinalized): |