aboutsummaryrefslogtreecommitdiffstats
path: root/tests/hazmat/primitives/test_hashes.py
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2014-10-30 08:38:57 -0500
committerPaul Kehrer <paul.l.kehrer@gmail.com>2014-10-30 08:38:57 -0500
commit147703e9db15f4fddf13afc354a52e9777eb2dae (patch)
treefed948a7499ef19dcb4a30e53877edb7a17f73f2 /tests/hazmat/primitives/test_hashes.py
parent142abb566e63e9e15de8afe64be254e91e93c298 (diff)
parenta201a2f7312dc542db1e833bfb195fcd2d957ee3 (diff)
downloadcryptography-147703e9db15f4fddf13afc354a52e9777eb2dae.tar.gz
cryptography-147703e9db15f4fddf13afc354a52e9777eb2dae.tar.bz2
cryptography-147703e9db15f4fddf13afc354a52e9777eb2dae.zip
Merge pull request #1451 from alex/use-full-impls
When using a test double for backends, always use one which really implements the interface
Diffstat (limited to 'tests/hazmat/primitives/test_hashes.py')
-rw-r--r--tests/hazmat/primitives/test_hashes.py16
1 files changed, 5 insertions, 11 deletions
diff --git a/tests/hazmat/primitives/test_hashes.py b/tests/hazmat/primitives/test_hashes.py
index 0fdd7550..053a1a46 100644
--- a/tests/hazmat/primitives/test_hashes.py
+++ b/tests/hazmat/primitives/test_hashes.py
@@ -20,13 +20,12 @@ import pytest
import six
from cryptography import utils
-from cryptography.exceptions import (
- AlreadyFinalized, _Reasons
-)
+from cryptography.exceptions import AlreadyFinalized, _Reasons
from cryptography.hazmat.backends.interfaces import HashBackend
from cryptography.hazmat.primitives import hashes, interfaces
from .utils import generate_base_hash_test
+from ..backends.test_multibackend import DummyHashBackend
from ...utils import raises_unsupported_algorithm
@@ -45,16 +44,11 @@ class TestHashContext(object):
m.update(six.u("\u00FC"))
def test_copy_backend_object(self):
- @utils.register_interface(HashBackend)
- class PretendBackend(object):
- pass
-
- pretend_backend = PretendBackend()
+ backend = DummyHashBackend([hashes.SHA1])
copied_ctx = pretend.stub()
pretend_ctx = pretend.stub(copy=lambda: copied_ctx)
- h = hashes.Hash(hashes.SHA1(), backend=pretend_backend,
- ctx=pretend_ctx)
- assert h._backend is pretend_backend
+ h = hashes.Hash(hashes.SHA1(), backend=backend, ctx=pretend_ctx)
+ assert h._backend is backend
assert h.copy()._backend is h._backend
def test_hash_algorithm_instance(self, backend):