From eb49db17f85c1a359e319df1a9adadcc8ee7236f Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Mon, 9 Sep 2013 17:12:29 -0500 Subject: ascii decode on openssl_version_text + doc string improvements --- cryptography/bindings/openssl/api.py | 7 +++++-- tests/bindings/test_openssl.py | 7 +++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/cryptography/bindings/openssl/api.py b/cryptography/bindings/openssl/api.py index 87ed38fa..2c8fae3d 100644 --- a/cryptography/bindings/openssl/api.py +++ b/cryptography/bindings/openssl/api.py @@ -55,9 +55,12 @@ class API(object): int EVP_CIPHER_block_size(const EVP_CIPHER *); """) - """ Friendly string name of linked OpenSSL. """ def openssl_version_text(self): - return self._ffi.string(api._lib.OPENSSL_VERSION_TEXT) + """ Friendly string name of linked OpenSSL. + + Example: OpenSSL 1.0.1e Feb 11, 2013 + """ + return self._ffi.string(api._lib.OPENSSL_VERSION_TEXT).decode("ascii") def create_block_cipher_context(self, cipher, mode): ctx = self._ffi.new("EVP_CIPHER_CTX *") diff --git a/tests/bindings/test_openssl.py b/tests/bindings/test_openssl.py index 8704d933..db71e328 100644 --- a/tests/bindings/test_openssl.py +++ b/tests/bindings/test_openssl.py @@ -19,4 +19,11 @@ class TestOpenSSL(object): assert api def test_openssl_version_text(self): + """ This test checks the value of OPENSSL_VERSION_TEXT. + + Unfortunately, this define does not appear to have a + formal content definition, so for now we'll test to see + if it starts with OpenSSL as that appears to be true + for every OpenSSL. + """ assert api.openssl_version_text().find("OpenSSL") == 0 -- cgit v1.2.3