From 8aad028501ef434071d3969bce41c4e6375b4c61 Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Mon, 23 Feb 2015 22:03:09 -0600 Subject: rename dump to as_bytes --- tests/hazmat/backends/test_openssl.py | 4 ++-- tests/hazmat/primitives/test_rsa.py | 24 ++++++++++++------------ 2 files changed, 14 insertions(+), 14 deletions(-) (limited to 'tests') diff --git a/tests/hazmat/backends/test_openssl.py b/tests/hazmat/backends/test_openssl.py index b5de702d..8cf14b98 100644 --- a/tests/hazmat/backends/test_openssl.py +++ b/tests/hazmat/backends/test_openssl.py @@ -502,7 +502,7 @@ class TestRSAPEMSerialization(object): password = b"x" * 1024 key = RSA_KEY_2048.private_key(backend) with pytest.raises(ValueError): - key.dump( + key.as_bytes( serialization.Encoding.PEM, serialization.Format.PKCS8, serialization.BestAvailableEncryption(password) @@ -511,7 +511,7 @@ class TestRSAPEMSerialization(object): def test_unsupported_key_encoding(self): key = RSA_KEY_2048.private_key(backend) with pytest.raises(ValueError): - key.dump( + key.as_bytes( serialization.Encoding.DER, serialization.Format.PKCS8, serialization.NoEncryption() diff --git a/tests/hazmat/primitives/test_rsa.py b/tests/hazmat/primitives/test_rsa.py index a0df2f26..17a2a414 100644 --- a/tests/hazmat/primitives/test_rsa.py +++ b/tests/hazmat/primitives/test_rsa.py @@ -1764,10 +1764,10 @@ class TestRSAPEMWriter(object): ] ) ) - def test_dump_encrypted_pem(self, backend, fmt, password): + def test_as_bytes_encrypted_pem(self, backend, fmt, password): key = RSA_KEY_2048.private_key(backend) _skip_if_no_serialization(key, backend) - serialized = key.dump( + serialized = key.as_bytes( serialization.Encoding.PEM, fmt, serialization.BestAvailableEncryption(password) @@ -1783,10 +1783,10 @@ class TestRSAPEMWriter(object): "fmt", (serialization.Format.TraditionalOpenSSL, serialization.Format.PKCS8), ) - def test_dump_unencrypted_pem(self, backend, fmt): + def test_as_bytes_unencrypted_pem(self, backend, fmt): key = RSA_KEY_2048.private_key(backend) _skip_if_no_serialization(key, backend) - serialized = key.dump( + serialized = key.as_bytes( serialization.Encoding.PEM, fmt, serialization.NoEncryption() @@ -1798,41 +1798,41 @@ class TestRSAPEMWriter(object): priv_num = key.private_numbers() assert loaded_priv_num == priv_num - def test_dump_invalid_encoding(self, backend): + def test_as_bytes_invalid_encoding(self, backend): key = RSA_KEY_2048.private_key(backend) _skip_if_no_serialization(key, backend) with pytest.raises(TypeError): - key.dump( + key.as_bytes( "notencoding", serialization.Format.PKCS8, serialization.NoEncryption() ) - def test_dump_invalid_format(self, backend): + def test_as_bytes_invalid_format(self, backend): key = RSA_KEY_2048.private_key(backend) _skip_if_no_serialization(key, backend) with pytest.raises(TypeError): - key.dump( + key.as_bytes( serialization.Encoding.PEM, "invalidformat", serialization.NoEncryption() ) - def test_dump_invalid_encryption_algorithm(self, backend): + def test_as_bytes_invalid_encryption_algorithm(self, backend): key = RSA_KEY_2048.private_key(backend) _skip_if_no_serialization(key, backend) with pytest.raises(TypeError): - key.dump( + key.as_bytes( serialization.Encoding.PEM, serialization.Format.TraditionalOpenSSL, "notanencalg" ) - def test_dump_unsupported_encryption_type(self, backend): + def test_as_bytes_unsupported_encryption_type(self, backend): key = RSA_KEY_2048.private_key(backend) _skip_if_no_serialization(key, backend) with pytest.raises(ValueError): - key.dump( + key.as_bytes( serialization.Encoding.PEM, serialization.Format.TraditionalOpenSSL, DummyKeyEncryption() -- cgit v1.2.3