diff options
author | Alex Gaynor <alex.gaynor@gmail.com> | 2013-11-12 09:37:59 -0800 |
---|---|---|
committer | Alex Gaynor <alex.gaynor@gmail.com> | 2013-11-12 09:37:59 -0800 |
commit | ab53bc525aace45158daf1bdfbac16c5e62593df (patch) | |
tree | 3c8a07c4f35dabc8375238f6cd7b9ffb7bda5178 /tests | |
parent | cee8d525a4b2e42872ad8daf1404d7bebe820021 (diff) | |
download | cryptography-ab53bc525aace45158daf1bdfbac16c5e62593df.tar.gz cryptography-ab53bc525aace45158daf1bdfbac16c5e62593df.tar.bz2 cryptography-ab53bc525aace45158daf1bdfbac16c5e62593df.zip |
simplify
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_utils.py | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/tests/test_utils.py b/tests/test_utils.py index 6251242d..9d2ee4a5 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -11,9 +11,9 @@ # See the License for the specific language governing permissions and # limitations under the License. +import os import textwrap -import py import pytest from .utils import ( @@ -250,14 +250,20 @@ def test_load_hash_vectors_bad_data(): with pytest.raises(ValueError): load_hash_vectors(vector_data) -def test_load_vectors_from_file(request): - path = py.path.local(__file__).dirpath().join( - "hazmat", "primitives", "vectors", "t.txt" +def test_load_vectors_from_file(): + vectors = load_vectors_from_file( + os.path.join("ciphers", "Blowfish", "bf-cfb.txt"), + load_nist_vectors, ) - path.write(textwrap.dedent(""" - abc - 123 - """)) - request.addfinalizer(path.remove) - vectors = load_vectors_from_file("t.txt", lambda f: f.readlines()) - assert vectors == ["\n", "abc\n", "123\n"] + assert vectors == [ + { + "key": "0123456789ABCDEFF0E1D2C3B4A59687", + "iv": "FEDCBA9876543210", + "plaintext": ( + "37363534333231204E6F77206973207468652074696D6520666F722000" + ), + "ciphertext": ( + "E73214A2822139CAF26ECF6D2EB9E76E3DA3DE04D1517200519D57A6C3" + ), + } + ] |