diff options
author | Paul Kehrer <paul.l.kehrer@gmail.com> | 2013-10-20 13:45:23 -0500 |
---|---|---|
committer | Paul Kehrer <paul.l.kehrer@gmail.com> | 2013-10-22 16:50:52 -0500 |
commit | 7a2a19176716530e938e31e09eac2dde679031ab (patch) | |
tree | 6df4ecb5161479a10e0f0efc338c8efe170680e0 /tests/primitives/test_hashes.py | |
parent | daac6d056753614077941da0a392c086dadbe965 (diff) | |
download | cryptography-7a2a19176716530e938e31e09eac2dde679031ab.tar.gz cryptography-7a2a19176716530e938e31e09eac2dde679031ab.tar.bz2 cryptography-7a2a19176716530e938e31e09eac2dde679031ab.zip |
add test to verify api is being copied in hash
Diffstat (limited to 'tests/primitives/test_hashes.py')
-rw-r--r-- | tests/primitives/test_hashes.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/primitives/test_hashes.py b/tests/primitives/test_hashes.py index d721f7af..07e2d8e7 100644 --- a/tests/primitives/test_hashes.py +++ b/tests/primitives/test_hashes.py @@ -13,6 +13,8 @@ from __future__ import absolute_import, division, print_function +import pretend + import pytest import six @@ -35,6 +37,15 @@ class TestBaseHash(object): assert isinstance(m.hexdigest(), str) +class TestCopyHash(object): + def test_copy_api_object(self): + pretend_api = pretend.stub(copy_hash_context=lambda a: "copiedctx") + pretend_ctx = pretend.stub() + h = hashes.SHA1(api=pretend_api, ctx=pretend_ctx) + assert h._api is pretend_api + assert h.copy()._api is h._api + + class TestDefaultAPISHA1(object): def test_default_api_creation(self): """ |