diff options
author | Alex Gaynor <alex.gaynor@gmail.com> | 2016-01-13 22:22:18 -0500 |
---|---|---|
committer | Alex Gaynor <alex.gaynor@gmail.com> | 2016-01-13 22:22:18 -0500 |
commit | 3066bf4150635a8c6be5ddb8dc4da20721d5daed (patch) | |
tree | 311a5cf5ea95e00d9ee00f2f466e39f202fd096d | |
parent | b301627b88f1535d63e2bccbd7845161f7c619b8 (diff) | |
download | cryptography-3066bf4150635a8c6be5ddb8dc4da20721d5daed.tar.gz cryptography-3066bf4150635a8c6be5ddb8dc4da20721d5daed.tar.bz2 cryptography-3066bf4150635a8c6be5ddb8dc4da20721d5daed.zip |
resolve the TODO, random block sizes
-rw-r--r-- | tests/hypothesis/test_padding.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/tests/hypothesis/test_padding.py b/tests/hypothesis/test_padding.py index d2b77756..21c9a234 100644 --- a/tests/hypothesis/test_padding.py +++ b/tests/hypothesis/test_padding.py @@ -3,15 +3,16 @@ # for complete details. from hypothesis import given -from hypothesis.strategies import binary +from hypothesis.strategies import binary, integers from cryptography.hazmat.primitives.padding import PKCS7 -@given(binary()) -def test_pkcs7(data): - # TODO: add additional tests with arbitrary block sizes - p = PKCS7(block_size=128) +@given(integers(min_value=1, max_value=31), binary()) +def test_pkcs7(block_size, data): + # Generate in [1, 31] so we can easily get block_size in bits by + # multiplying by 8. + p = PKCS7(block_size=block_size * 8) padder = p.padder() unpadder = p.unpadder() |