diff options
author | Alex Gaynor <alex.gaynor@gmail.com> | 2013-10-29 14:38:06 -0700 |
---|---|---|
committer | Alex Gaynor <alex.gaynor@gmail.com> | 2013-10-29 14:38:06 -0700 |
commit | 5787fb5dcde454404bfa9c2ec1a601bbafd62404 (patch) | |
tree | 46633e83c9ad17a34502ffb83f6e29cb98ae89e0 /tests | |
parent | 60ad3e182476d84daeb7cff9d333623a688edd61 (diff) | |
download | cryptography-5787fb5dcde454404bfa9c2ec1a601bbafd62404.tar.gz cryptography-5787fb5dcde454404bfa9c2ec1a601bbafd62404.tar.bz2 cryptography-5787fb5dcde454404bfa9c2ec1a601bbafd62404.zip |
raise an error if you unicode
Diffstat (limited to 'tests')
-rw-r--r-- | tests/hazmat/primitives/test_padding.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/hazmat/primitives/test_padding.py b/tests/hazmat/primitives/test_padding.py index 798b2a77..3cefafaf 100644 --- a/tests/hazmat/primitives/test_padding.py +++ b/tests/hazmat/primitives/test_padding.py @@ -13,6 +13,8 @@ import pytest +import six + from cryptography.hazmat.primitives import padding @@ -34,6 +36,14 @@ class TestPKCS7(object): unpadder.update(padded) unpadder.finalize() + def test_non_bytes(self): + padder = padding.PKCS7(128).padder() + with pytest.raises(TypeError): + padder.update(six.u("abc")) + unpadder = padding.PKCS7(128).unpadder() + with pytest.raises(TypeError): + unpadder.update(six.u("abc")) + @pytest.mark.parametrize(("size", "unpadded", "padded"), [ ( 128, |