diff options
author | Paul Kehrer <paul.l.kehrer@gmail.com> | 2022-05-12 06:33:36 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-11 18:33:36 -0400 |
commit | 069909af77171b1d925aed6cefe168a7e5e50f50 (patch) | |
tree | d31027412aa19a4c33832cc23b5f0d5e5d156792 /tests | |
parent | 5a30471edc26efd38cb052d1ed923f2626e60c45 (diff) | |
download | pyopenssl-git-069909af77171b1d925aed6cefe168a7e5e50f50.tar.gz |
repair CI (#1116)
* repair CI
* more fixes
* pypy39 requires latest cryptography
* Apply suggestions from code review
Co-authored-by: Alex Gaynor <alex.gaynor@gmail.com>
* use constant
* bump minimum version
* remove unneeded try
* fix
Co-authored-by: Alex Gaynor <alex.gaynor@gmail.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_crypto.py | 10 | ||||
-rw-r--r-- | tests/test_ssl.py | 36 |
2 files changed, 31 insertions, 15 deletions
diff --git a/tests/test_crypto.py b/tests/test_crypto.py index 8e8484c..6d60347 100644 --- a/tests/test_crypto.py +++ b/tests/test_crypto.py @@ -2077,8 +2077,8 @@ class TestX509(_PKeyInteractionTestsMixin): b"DNS:altnull.python.org\x00example.com, " b"email:null@python.org\x00user@example.org, " b"URI:http://null.python.org\x00http://example.org, " - b"IP Address:192.0.2.1, IP Address:2001:DB8:0:0:0:0:0:1\n" - == str(ext).encode("ascii") + b"IP Address:192.0.2.1, IP Address:2001:DB8:0:0:0:0:0:1" + == str(ext).encode("ascii").strip() ) def test_invalid_digest_algorithm(self): @@ -4090,7 +4090,11 @@ class TestX509StoreContext: with pytest.raises(X509StoreContextError) as exc: store_ctx.verify_certificate() - assert exc.value.args[0][2] == "self signed certificate" + # OpenSSL 1.1.x and 3.0.x have different error messages + assert exc.value.args[0][2] in [ + "self signed certificate", + "self-signed certificate", + ] assert exc.value.certificate.get_subject().CN == "Testing Root CA" def test_invalid_chain_no_root(self): diff --git a/tests/test_ssl.py b/tests/test_ssl.py index a02dc4b..56748fa 100644 --- a/tests/test_ssl.py +++ b/tests/test_ssl.py @@ -517,15 +517,20 @@ class TestContext: """ with pytest.raises(Error) as excinfo: context.set_cipher_list(b"imaginary-cipher") - assert excinfo.value.args == ( - [ - ( - "SSL routines", - "SSL_CTX_set_cipher_list", - "no cipher match", - ) - ], - ) + assert excinfo.value.args[0][0] in [ + # 1.1.x + ( + "SSL routines", + "SSL_CTX_set_cipher_list", + "no cipher match", + ), + # 3.0.x + ( + "SSL routines", + "", + "no cipher match", + ), + ] def test_load_client_ca(self, context, ca_file): """ @@ -564,13 +569,20 @@ class TestContext: with pytest.raises(Error) as e: context.set_session_id(b"abc" * 1000) - assert [ + assert e.value.args[0][0] in [ + # 1.1.x ( "SSL routines", "SSL_CTX_set_session_id_context", "ssl session id context too long", - ) - ] == e.value.args[0] + ), + # 3.0.x + ( + "SSL routines", + "", + "ssl session id context too long", + ), + ] def test_set_session_id_unicode(self, context): """ |