From 733404a826678538f0b67d666d4c303b1ccc2204 Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Mon, 9 Sep 2013 15:26:26 -0500 Subject: Add method to bindings to get OPENSSL_VERSION_TEXT * This allows you to check that you're binding against the expected version of OpenSSL * Test is pretty basic (just checks to see that the string starts with OpenSSL) --- tests/bindings/test_openssl.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'tests') diff --git a/tests/bindings/test_openssl.py b/tests/bindings/test_openssl.py index 9d637222..8704d933 100644 --- a/tests/bindings/test_openssl.py +++ b/tests/bindings/test_openssl.py @@ -17,3 +17,6 @@ from cryptography.bindings.openssl import api class TestOpenSSL(object): def test_api_exists(self): assert api + + def test_openssl_version_text(self): + assert api.openssl_version_text().find("OpenSSL") == 0 -- cgit v1.2.3 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 --- tests/bindings/test_openssl.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'tests') 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 From bdafcd39172e118c4fc475770546ccef4d5e5784 Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Mon, 9 Sep 2013 17:44:11 -0500 Subject: openssl_version_text now calls startswith rather than find --- tests/bindings/test_openssl.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/bindings/test_openssl.py b/tests/bindings/test_openssl.py index db71e328..e0baaf53 100644 --- a/tests/bindings/test_openssl.py +++ b/tests/bindings/test_openssl.py @@ -26,4 +26,4 @@ class TestOpenSSL(object): if it starts with OpenSSL as that appears to be true for every OpenSSL. """ - assert api.openssl_version_text().find("OpenSSL") == 0 + assert api.openssl_version_text().startswith("OpenSSL") -- cgit v1.2.3 From c1a218d3b9d8ca02851df3b8eebb4685bd35776f Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Mon, 9 Sep 2013 17:45:52 -0500 Subject: Update docstring to pass alex8 linting --- tests/bindings/test_openssl.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/bindings/test_openssl.py b/tests/bindings/test_openssl.py index e0baaf53..1579f002 100644 --- a/tests/bindings/test_openssl.py +++ b/tests/bindings/test_openssl.py @@ -19,7 +19,8 @@ class TestOpenSSL(object): assert api def test_openssl_version_text(self): - """ This test checks the value of OPENSSL_VERSION_TEXT. + """ + 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 -- cgit v1.2.3